From bc3f7c89a9e722a76f9137bb503a1c8d1bfc6982 Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Wed, 23 Nov 2011 22:44:15 +0000 Subject: [PATCH] // git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10628 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/themes/template/login/content.tpl | 2 +- js/login.js | 94 +++++++++------------ 2 files changed, 43 insertions(+), 53 deletions(-) diff --git a/admin-dev/themes/template/login/content.tpl b/admin-dev/themes/template/login/content.tpl index 754b7f736..04064b888 100755 --- a/admin-dev/themes/template/login/content.tpl +++ b/admin-dev/themes/template/login/content.tpl @@ -96,7 +96,7 @@ -
{l s='Back to login'}
+
{l s='Back to login'}

© Copyright by PrestaShop. all rights reserved.

diff --git a/js/login.js b/js/login.js index c5b49ff03..449a4b3e0 100644 --- a/js/login.js +++ b/js/login.js @@ -1,46 +1,46 @@ -$(document).ready(function(){ - if (document.getElementById('email')) - document.getElementById('email').focus(); +$(document).ready(function() { + if (document.getElementById('email')) document.getElementById('email').focus(); + //$("#login").effect( "slide", { direction: "up" }, 1000 ); }); - -function displayForgotPassword() -{ +function displayForgotPassword() { $('#error').hide(); $("#login").flip({ - direction:'tb', - color : '#FFF', + direction: 'tb', + color: '#FFF', content: $('#forgot_password') }) } - -function doAjaxLogin() -{ +function displayLogin() { $('#error').hide(); - $('#ajax-loader').fadeIn('slow', function () { + $('#login').revertFlip(); + return false; +} +function doAjaxLogin() { + $('#error').hide(); + $('#ajax-loader').fadeIn('slow', function() { $.ajax({ - type:"POST", + type: "POST", url: "ajax-tab.php", async: true, dataType: "json", - data : { + data: { ajax: "1", token: "", controller: "AdminLogin", submitLogin: "1", - passwd : $('#passwd').val(), - email : $('#email').val() - }, - success : function(jsonData) - { - if (jsonData.hasErrors) - { + passwd: $('#passwd').val(), + email: $('#email').val() + }, + success: function(jsonData) { + if (jsonData.hasErrors) { displayErrors(jsonData.errors); - $('#login').effect("shake", { times:3 }, 300); - } - else - { - window.location.href = jsonData.redirect; + } else { + $("#login").effect("slide", { + direction: "up" + }, 1000, function() { + window.location.href = jsonData.redirect; + }); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { @@ -50,34 +50,26 @@ function doAjaxLogin() } }); }); - } - -function doAjaxForgot() -{ +function doAjaxForgot() { $('#error').hide(); - $('#ajax-loader').fadeIn('slow', function () { + $('#ajax-loader').fadeIn('slow', function() { $.ajax({ - type:"POST", + type: "POST", url: "ajax-tab.php", async: true, dataType: "json", - data : { + data: { ajax: "1", token: "", controller: "AdminLogin", submitForgot: "1", email_forgot: $('#email_forgot').val() - }, - success : function(jsonData) - { - if (jsonData.hasErrors) - { + }, + success: function(jsonData) { + if (jsonData.hasErrors) { displayErrors(jsonData.errors); - $('#login').effect("shake", { times:3 }, 300); - } - else - { + } else { window.location.href = jsonData.redirect; } }, @@ -89,16 +81,14 @@ function doAjaxForgot() }); }); } - -function displayErrors(errors) -{ - str_errors = '

'+(errors.length > 1 ? there_are : there_is )+' '+errors.length+' '+(errors.length > 1 ? label_errors : label_error )+'

    '; - for(error in errors) - //IE6 bug fix - if(error != 'indexOf') - str_errors += '
  1. '+errors[error] + '
  2. '; +function displayErrors(errors) { + str_errors = '

    ' + (errors.length > 1 ? there_are : there_is) + ' ' + errors.length + ' ' + (errors.length > 1 ? label_errors : label_error) + '

      '; + for (error in errors) //IE6 bug fix + if (error != 'indexOf') str_errors += '
    1. ' + errors[error] + '
    2. '; $('#ajax-loader').fadeOut('slow'); - $('#error').html(str_errors+'
    '); + $('#error').html(str_errors + '
'); $('#error').fadeIn(); + $("#login").effect("shake", { + times: 4 + }, 100); } -