Here you will find the solution that enable your customer to retype password for confirmation (password confirm) at account sign up at PrestaShop.
1. Add a new field to the sing up for password confirm at file ./themes/YourTheme/authentication.tpl.
Search in file authentication.tpl for following blue highlighted text class="required password", you will find following exiting code for password field.
<p class="required password">
<label for="passwd">{l s='Password'}</label>
<input type="password" class="text" name="passwd" id="passwd" />
<sup>*</sup>
<span class="form_info">{l s='(5 characters min.)'}</span>
</p>
Insert the following new code right after above code.
<p class="required password">
<label for="passwd_confirm">{l s='Confirm password'}</label>
<input type="password" class="text" name="passwd_confirm" id="passwd_confirm" />
<sup>*</sup>
</p>
2. Add validation to validate password is matched at ./authentication.php
Search in file authenticatio.php for following blue highlighted text isSubmit('submitAccount'), you will following code
if (Tools::isSubmit('submitAccount'))
{
$create_account = 1;
$smarty->assign('email_create', 1);
$validateDni = Validate::isDni(Tools::getValue('dni'));
if (!Validate::isEmail($email = Tools::getValue('email')))
$errors[] = Tools::displayError('e-mail not valid');
elseif (!Validate::isPasswd(Tools::getValue('passwd')))
$errors[] = Tools::displayError('invalid password');
Append following code right after above code
elseif (Tools::getValue('passwd') != Tools::getValue('passwd_confirm'))
$errors[] = Tools::displayError('your password and confirm password input do not match');
3. Congratulations! You are done. You can test your work now.
Note:
If your store are supporting multiple language, you will need to translate a new password confirm validation error message.
On how to translate, see PrestaShop related documents.
5 comments:
Thanks dude!
Have tried this in version 1.4.4 and it doesn't work :-( Is there an updated version of this? It's really a great idea and avoivs those undeliverable emails to customers who make typos!
the code should be the same for 1.3x and 1.4x.
The only different is that in 1.4x, the PHP code should in controller class file which is at
/controllers/AuthController.php
As long as you put it correctly, it should be working.
For prestahop 1.4.3 and above i think
go to the last page ( 3 at this time) find post by fcarlao;
http://www.prestashop.com/forums/topic/24636-solved-password-confirm/
thanks for comment and sharing the information.
Post a Comment