[Pkg-owncloud-commits] [owncloud] 65/153: Disable login button until the timezone is set

David Prévot taffit at moszumanska.debian.org
Tue May 27 03:05:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 1de068b5cbddd1ccd45588b50372f5a4f68a7054
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Wed May 14 17:00:15 2014 +0200

    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 ee0105c..d9b63a1 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 65f760c..669d20b 100644
--- a/core/templates/login.php
+++ b/core/templates/login.php
@@ -51,7 +51,7 @@
 		<label for="remember_login"><?php p($l->t('remember')); ?></label>
 		<?php endif; ?>
 		<input type="hidden" name="timezone-offset" id="timezone-offset"/>
-		<input type="submit" id="submit" class="login primary" value="<?php p($l->t('Log in')); ?>"/>
+		<input type="submit" id="submit" class="login primary" value="<?php p($l->t('Log in')); ?>" disabled="disabled"/>
 	</fieldset>
 </form>
 <?php if (!empty($_['alt_login'])) { ?>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list