// improve authentification.tpl code, in order to display errors messages.
This commit is contained in:
@@ -328,6 +328,8 @@ class AuthControllerCore extends FrontController
|
|||||||
);
|
);
|
||||||
die(Tools::jsonEncode($return));
|
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))
|
if (!Validate::isEmail($email = Tools::getValue('email')) || empty($email))
|
||||||
$this->errors[] = Tools::displayError('Invalid e-mail address');
|
$this->errors[] = Tools::displayError('Invalid e-mail address');
|
||||||
elseif (Customer::customerExists($email))
|
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
|
// Preparing customer
|
||||||
$customer = new Customer();
|
$customer = new Customer();
|
||||||
$_POST['lastname'] = Tools::getValue('customer_lastname');
|
$_POST['lastname'] = Tools::getValue('customer_lastname');
|
||||||
@@ -580,6 +582,7 @@ class AuthControllerCore extends FrontController
|
|||||||
);
|
);
|
||||||
die(Tools::jsonEncode($return));
|
die(Tools::jsonEncode($return));
|
||||||
}
|
}
|
||||||
|
$this->context->smarty->assign('account_error', $this->errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,20 @@ $(function(){ldelim}
|
|||||||
}
|
}
|
||||||
{/literal}
|
{/literal}
|
||||||
</script>
|
</script>
|
||||||
|
{if isset($authentification_error)}
|
||||||
|
<div class="error">
|
||||||
|
{if {$authentification_error|@count} == 1}
|
||||||
|
<p>{l s='There is one error'} :</p>
|
||||||
|
{else}
|
||||||
|
<p>{l s='There are '}{$account_error|@count} {l s='errors'} :</p>
|
||||||
|
{/if}
|
||||||
|
<ol>
|
||||||
|
{foreach from=$authentification_error item=v}
|
||||||
|
<li>{$v}</li>
|
||||||
|
{/foreach}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<form action="{$link->getPageLink('authentication', true)}" method="post" id="create-account_form" class="std">
|
<form action="{$link->getPageLink('authentication', true)}" method="post" id="create-account_form" class="std">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<h3>{l s='Create your account'}</h3>
|
<h3>{l s='Create your account'}</h3>
|
||||||
@@ -348,6 +362,20 @@ $(function(){ldelim}
|
|||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
{else}
|
{else}
|
||||||
|
{if isset($account_error)}
|
||||||
|
<div class="error">
|
||||||
|
{if {$account_error|@count} == 1}
|
||||||
|
<p>{l s='There is one error'} :</p>
|
||||||
|
{else}
|
||||||
|
<p>{l s='There are '}{$account_error|@count} {l s='errors'} :</p>
|
||||||
|
{/if}
|
||||||
|
<ol>
|
||||||
|
{foreach from=$account_error item=v}
|
||||||
|
<li>{$v}</li>
|
||||||
|
{/foreach}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<form action="{$link->getPageLink('authentication', true)}" method="post" id="account-creation_form" class="std">
|
<form action="{$link->getPageLink('authentication', true)}" method="post" id="account-creation_form" class="std">
|
||||||
{$HOOK_CREATE_ACCOUNT_TOP}
|
{$HOOK_CREATE_ACCOUNT_TOP}
|
||||||
<fieldset class="account_creation">
|
<fieldset class="account_creation">
|
||||||
|
|||||||
Reference in New Issue
Block a user