summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorAbijeet <abijeetpatro@gmail.com>2017-12-28 01:41:16 +0530
committerAbijeet <abijeetpatro@gmail.com>2018-01-08 23:47:52 +0530
commitde5467811a52abcc16d0b536136e09f1b614d79c (patch)
treeba32f0db3b4ae44bd4c122d175f91fd6d4e0d208 /core/js
parentf25e51c3691e8dce3c0f6c8ed56f4effa9ebb0dc (diff)
downloadnextcloud-server-de5467811a52abcc16d0b536136e09f1b614d79c.tar.gz
nextcloud-server-de5467811a52abcc16d0b536136e09f1b614d79c.zip
Fixes password input being prompted every time.
Fixes #7106 - Echoing the current server time via a JS variable and storing the current time on page load in JS. - Calculating the diff and taking it into account when deciding whether to show the password confirmation. Signed-off-by: Abijeet <abijeetpatro@gmail.com>
Diffstat (limited to 'core/js')
-rw-r--r--core/js/js.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js
index f9a5f2b3381..872761c02bb 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1675,13 +1675,16 @@ function initCore() {
OC.PasswordConfirmation = {
callback: null,
-
+ pageLoadTime: null,
init: function() {
$('.password-confirm-required').on('click', _.bind(this.requirePasswordConfirmation, this));
+ this.pageLoadTime = moment.now();
},
requiresPasswordConfirmation: function() {
- var timeSinceLogin = moment.now() - (nc_lastLogin * 1000);
+ var serverTimeDiff = this.pageLoadTime - (nc_pageLoad * 1000);
+ var timeSinceLogin = moment.now() - (serverTimeDiff + (nc_lastLogin * 1000));
+
// if timeSinceLogin > 30 minutes and user backend allows password confirmation
return (backendAllowsPasswordConfirmation && timeSinceLogin > 30 * 60 * 1000);
},