From 1de068b5cbddd1ccd45588b50372f5a4f68a7054 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 14 May 2014 17:00:15 +0200 Subject: [PATCH] Disable login button until the timezone is set On slow computers it might happen that the user manages to login before the timezone code has a chance to run, which then causes dates to appear wrong in the UI. This fix makes sure the login cannot happen until the timezone field is set. Note that it's not possible to run the timezone code outside of document.ready() because at that time the DOM element doesn't exist yet. --- core/js/visitortimezone.js | 6 ++++++ core/templates/login.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/js/visitortimezone.js b/core/js/visitortimezone.js index ee0105c783..d9b63a1087 100644 --- a/core/js/visitortimezone.js +++ b/core/js/visitortimezone.js @@ -1,4 +1,10 @@ $(document).ready(function () { var visitortimezone = (-new Date().getTimezoneOffset() / 60); $('#timezone-offset').val(visitortimezone); + + // only enable the submit button once we are sure that the timezone is set + var $loginForm = $('form[name="login"]'); + if ($loginForm.length) { + $loginForm.find('input#submit').prop('disabled', false); + } }); diff --git a/core/templates/login.php b/core/templates/login.php index 65f760c1ee..669d20b32e 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -51,7 +51,7 @@ - +