Allow to check it via the API
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
28ddf3abdb
commit
a0d6c6593a
1 changed files with 16 additions and 2 deletions
|
@ -1521,6 +1521,7 @@ OC.PasswordConfirmation = {
|
|||
$background: null,
|
||||
$input: null,
|
||||
$submit: null,
|
||||
callback: null,
|
||||
|
||||
init: function() {
|
||||
this.$form = $('#sudo-login-form');
|
||||
|
@ -1533,9 +1534,16 @@ OC.PasswordConfirmation = {
|
|||
this.$submit.on('click', _.bind(this._submitPasswordConfirmation, this));
|
||||
},
|
||||
|
||||
requirePasswordConfirmation: function() {
|
||||
requiresPasswordConfirmation: function() {
|
||||
var timeSinceLogin = moment.now() - nc_lastLogin * 1000;
|
||||
if (timeSinceLogin > 30 * 60 * 1000) { // 30 minutes
|
||||
return timeSinceLogin > 30 * 60 * 1000; // 30 minutes
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {function} callback
|
||||
*/
|
||||
requirePasswordConfirmation: function(callback) {
|
||||
if (this.requiresPasswordConfirmation()) {
|
||||
this.$form.removeClass('hidden');
|
||||
this.$background.removeClass('hidden');
|
||||
|
||||
|
@ -1544,6 +1552,8 @@ OC.PasswordConfirmation = {
|
|||
this.$input.val('');
|
||||
}
|
||||
}
|
||||
|
||||
this.callback = callback;
|
||||
},
|
||||
|
||||
_submitPasswordConfirmation: function() {
|
||||
|
@ -1563,6 +1573,10 @@ OC.PasswordConfirmation = {
|
|||
|
||||
self.$form.addClass('hidden');
|
||||
self.$background.addClass('hidden');
|
||||
|
||||
if (!_.isUndefined(self.callback)) {
|
||||
self.callback();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
OC.Notification.showTemporary(t('core', 'Failed to authenticate, try again'));
|
||||
|
|
Loading…
Reference in a new issue