summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/js/js.js18
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'));