|
|
|
|
@ -183,6 +183,8 @@
|
|
|
|
|
|
|
|
|
|
_newAppPassword: undefined,
|
|
|
|
|
|
|
|
|
|
_newAppId: undefined,
|
|
|
|
|
|
|
|
|
|
_hideAppPasswordBtn: undefined,
|
|
|
|
|
|
|
|
|
|
_addingToken: false,
|
|
|
|
|
@ -216,6 +218,38 @@
|
|
|
|
|
this._newAppPassword.on('focus', _.bind(this._onNewTokenFocus, this));
|
|
|
|
|
this._hideAppPasswordBtn = $('#app-password-hide');
|
|
|
|
|
this._hideAppPasswordBtn.click(_.bind(this._hideToken, this));
|
|
|
|
|
|
|
|
|
|
// Clipboard!
|
|
|
|
|
var clipboard = new Clipboard('.clipboardButton');
|
|
|
|
|
clipboard.on('success', function(e) {
|
|
|
|
|
var $input = $(e.trigger);
|
|
|
|
|
$input.tooltip({placement: 'bottom', trigger: 'manual', title: t('core', 'Copied!')});
|
|
|
|
|
$input.tooltip('show');
|
|
|
|
|
_.delay(function() {
|
|
|
|
|
$input.tooltip('hide');
|
|
|
|
|
}, 3000);
|
|
|
|
|
});
|
|
|
|
|
clipboard.on('error', function (e) {
|
|
|
|
|
var $input = $(e.trigger);
|
|
|
|
|
var actionMsg = '';
|
|
|
|
|
if (/iPhone|iPad/i.test(navigator.userAgent)) {
|
|
|
|
|
actionMsg = t('core', 'Not supported!');
|
|
|
|
|
} else if (/Mac/i.test(navigator.userAgent)) {
|
|
|
|
|
actionMsg = t('core', 'Press ⌘-C to copy.');
|
|
|
|
|
} else {
|
|
|
|
|
actionMsg = t('core', 'Press Ctrl-C to copy.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$input.tooltip({
|
|
|
|
|
placement: 'bottom',
|
|
|
|
|
trigger: 'manual',
|
|
|
|
|
title: actionMsg
|
|
|
|
|
});
|
|
|
|
|
$input.tooltip('show');
|
|
|
|
|
_.delay(function () {
|
|
|
|
|
$input.tooltip('hide');
|
|
|
|
|
}, 3000);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
render: function () {
|
|
|
|
|
@ -255,10 +289,13 @@
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$.when(creatingToken).done(function (resp) {
|
|
|
|
|
// We can delete token we add
|
|
|
|
|
resp.deviceToken.canDelete = true;
|
|
|
|
|
_this.collection.add(resp.deviceToken);
|
|
|
|
|
_this.render();
|
|
|
|
|
_this._newAppLoginName.val(resp.loginName);
|
|
|
|
|
_this._newAppPassword.val(resp.token);
|
|
|
|
|
_this._newAppId = resp.deviceToken.id;
|
|
|
|
|
_this._toggleFormResult(false);
|
|
|
|
|
_this._newAppPassword.select();
|
|
|
|
|
_this._tokenName.val('');
|
|
|
|
|
@ -293,6 +330,10 @@
|
|
|
|
|
var $row = $target.closest('tr');
|
|
|
|
|
var id = $row.data('id');
|
|
|
|
|
|
|
|
|
|
if (id === this._newAppId) {
|
|
|
|
|
this._toggleFormResult(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var token = this.collection.get(id);
|
|
|
|
|
if (_.isUndefined(token)) {
|
|
|
|
|
// Ignore event
|
|
|
|
|
@ -313,8 +354,13 @@
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_toggleFormResult: function (showForm) {
|
|
|
|
|
this._form.toggleClass('hidden', !showForm);
|
|
|
|
|
this._result.toggleClass('hidden', showForm);
|
|
|
|
|
if (showForm) {
|
|
|
|
|
this._result.slideUp();
|
|
|
|
|
this._form.slideDown();
|
|
|
|
|
} else {
|
|
|
|
|
this._form.slideUp();
|
|
|
|
|
this._result.slideDown();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|