Allow to check it via the API

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2016-09-19 16:52:29 +02:00 committed by Lukas Reschke
parent 28ddf3abdb
commit a0d6c6593a
No known key found for this signature in database
GPG key ID: B9F6980CF6E759B1

View file

@ -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'));