From 08d0af28eef4daf42d60a633529df87efc65f144 Mon Sep 17 00:00:00 2001 From: mBertholino Date: Tue, 20 Dec 2011 14:39:27 +0000 Subject: [PATCH] // improve authentification.tpl code, in order to display errors messages. --- controllers/front/AuthController.php | 5 ++++- themes/default/authentication.tpl | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 123f1f23f..8731bb44a 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -328,6 +328,8 @@ class AuthControllerCore extends FrontController ); die(Tools::jsonEncode($return)); } + else + $this->context->smarty->assign('authentification_error', $this->errors); } /** @@ -349,7 +351,7 @@ class AuthControllerCore extends FrontController if (!Validate::isEmail($email = Tools::getValue('email')) || empty($email)) $this->errors[] = Tools::displayError('Invalid e-mail address'); elseif (Customer::customerExists($email)) - $this->errors[] = Tools::displayError('An account is already registered with this e-mail, please fill in the password or request a new one.'); + $this->errors[] = Tools::displayError('An account is already registered with this e-mail.'); // Preparing customer $customer = new Customer(); $_POST['lastname'] = Tools::getValue('customer_lastname'); @@ -580,6 +582,7 @@ class AuthControllerCore extends FrontController ); die(Tools::jsonEncode($return)); } + $this->context->smarty->assign('account_error', $this->errors); } } diff --git a/themes/default/authentication.tpl b/themes/default/authentication.tpl index 2165a20fd..02eb41420 100644 --- a/themes/default/authentication.tpl +++ b/themes/default/authentication.tpl @@ -151,6 +151,20 @@ $(function(){ldelim} } {/literal} + {if isset($authentification_error)} +
+ {if {$authentification_error|@count} == 1} +

{l s='There is one error'} :

+ {else} +

{l s='There are '}{$account_error|@count} {l s='errors'} :

+ {/if} +
    + {foreach from=$authentification_error item=v} +
  1. {$v}
  2. + {/foreach} +
+
+ {/if}

{l s='Create your account'}

@@ -348,6 +362,20 @@ $(function(){ldelim} {/if} {else} + {if isset($account_error)} +
+ {if {$account_error|@count} == 1} +

{l s='There is one error'} :

+ {else} +

{l s='There are '}{$account_error|@count} {l s='errors'} :

+ {/if} +
    + {foreach from=$account_error item=v} +
  1. {$v}
  2. + {/foreach} +
+
+ {/if}
{$HOOK_CREATE_ACCOUNT_TOP}