diff options
author | Joas Schilling <coding@schilljs.com> | 2016-09-19 16:52:29 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-11-18 11:57:16 +0100 |
commit | a0d6c6593a4c6f08c2c4dd516c85ad59eb639be2 (patch) | |
tree | bb61285b318d09406885c137d05d07fdbe31d9a8 | |
parent | 28ddf3abdbe481b8714bdd2bc9dad43c805680e4 (diff) | |
download | nextcloud-server-a0d6c6593a4c6f08c2c4dd516c85ad59eb639be2.tar.gz nextcloud-server-a0d6c6593a4c6f08c2c4dd516c85ad59eb639be2.zip |
Allow to check it via the API
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | core/js/js.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js index bc99e1c77da..f498ed751c0 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -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')); |