fatheeym Posted July 24, 2016 Share Posted July 24, 2016 (edited) first i have searched for the solution but non of theme worked with me i've delteted the password from welcome e-mail template so i have to add field in registration for Password Confirmation to avoid users type the password wrong --------- i'm using the last version of prestashop and the deafault theme thank you Edited July 24, 2016 by fatheeym (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted July 26, 2016 Share Posted July 26, 2016 (edited) Find the following code in themes/default-bootstrap/authentication.tpl at about line 492: <div class="required password form-group"> <label for="passwd">{l s='Password'} <sup>*</sup></label> <input type="password" class="is_required validate form-control" data-validate="isPasswd" name="passwd" id="passwd" /> <span class="form_info">{l s='(Five characters minimum)'}</span> </div> and then change it to: <div class="required password form-group"> <label for="passwd">{l s='Password'} <sup>*</sup></label> <input type="password" class="is_required validate form-control" data-validate="isPasswd" name="passwd" id="passwd" /> <span class="form_info">{l s='(Five characters minimum)'}</span> </div> <div class="required password form-group"> <label for="passwd">{l s='Confirmation'} <sup>*</sup></label> <input type="password" class="is_required validate form-control" data-validate="isPasswd" name="confirm" id="confirm_passwd" onblur="if ($(this).val() == $('#passwd').val()) $(this).parent().attr('class', 'required password form-group form-ok'); else $(this).parent().attr('class', 'required password form-group form-error');" /> </div> This will add a new "Confirmation" field that will turn red if the customer leaves the field and the value it doesn't match the "Password" field. If the passwords match, it will turn green. You'll also need to create override/controllers/front/AuthController.php with the following to prevent an account being created when the passwords don't match: <?php class AuthController extends AuthControllerCore { protected function processSubmitAccount() { if (Tools::getValue('passwd') != Tools::getValue('confirm')) { $this->errors[] = Tools::displayError('Password and confirmation do not match'); } parent::processSubmitAccount(); } } This will display a "Password and confirmation do not match" error message if a customer clicks the "Register" button when the passwords don't match. Remember to go to Advanced Parameters > Performance and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override. Edited July 31, 2016 by rocky Fixed authentication.tpl code (see edit history) 3 Link to comment Share on other sites More sharing options...
fatheeym Posted July 29, 2016 Author Share Posted July 29, 2016 thank you it's working very well except when users type the confirmation password wrong the field display it in green with right mark http://prnt.sc/bz0edi Link to comment Share on other sites More sharing options...
rocky Posted July 30, 2016 Share Posted July 30, 2016 You can change onblur to onkeyup if you'd rather the field update after each key is typed instead of when the customer leaves the field. 1 Link to comment Share on other sites More sharing options...
fatheeym Posted July 30, 2016 Author Share Posted July 30, 2016 i'm sorry but when i tried it it still the same :/ Link to comment Share on other sites More sharing options...
rocky Posted July 31, 2016 Share Posted July 31, 2016 Oops, I've fixed my authentication.tpl code above. Link to comment Share on other sites More sharing options...
fatheeym Posted July 31, 2016 Author Share Posted July 31, 2016 thank you very much Link to comment Share on other sites More sharing options...
fatheeym Posted July 31, 2016 Author Share Posted July 31, 2016 please rename it as solved for other members Link to comment Share on other sites More sharing options...
rocky Posted July 31, 2016 Share Posted July 31, 2016 You're welcome. Done. Link to comment Share on other sites More sharing options...
Pipex_9210 Posted May 19, 2018 Share Posted May 19, 2018 On 25/7/2016 at 6:12 PM, rocky said: Find the following code in themes/default-bootstrap/authentication.tpl at about line 492: <div class="required password form-group"> <label for="passwd">{l s='Password'} <sup>*</sup></label> <input type="password" class="is_required validate form-control" data-validate="isPasswd" name="passwd" id="passwd" /> <span class="form_info">{l s='(Five characters minimum)'}</span> </div> and then change it to: <div class="required password form-group"> <label for="passwd">{l s='Password'} <sup>*</sup></label> <input type="password" class="is_required validate form-control" data-validate="isPasswd" name="passwd" id="passwd" /> <span class="form_info">{l s='(Five characters minimum)'}</span> </div> <div class="required password form-group"> <label for="passwd">{l s='Confirmation'} <sup>*</sup></label> <input type="password" class="is_required validate form-control" data-validate="isPasswd" name="confirm" id="confirm_passwd" onblur="if ($(this).val() == $('#passwd').val()) $(this).parent().attr('class', 'required password form-group form-ok'); else $(this).parent().attr('class', 'required password form-group form-error');" /> </div> This will add a new "Confirmation" field that will turn red if the customer leaves the field and the value it doesn't match the "Password" field. If the passwords match, it will turn green. You'll also need to create override/controllers/front/AuthController.php with the following to prevent an account being created when the passwords don't match: <?php class AuthController extends AuthControllerCore { protected function processSubmitAccount() { if (Tools::getValue('passwd') != Tools::getValue('confirm')) { $this->errors[] = Tools::displayError('Password and confirmation do not match'); } parent::processSubmitAccount(); } } This will display a "Password and confirmation do not match" error message if a customer clicks the "Register" button when the passwords don't match. Remember to go to Advanced Parameters > Performance and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override. Hi, i just did this in prestashop 1.6.1.18 and works great, how can i do the same thing but with the email field? What i should change and where? Thank you very much Link to comment Share on other sites More sharing options...
mma87 Posted April 18, 2019 Share Posted April 18, 2019 Hello, I made this customization for prestashop 1.7.5.1 you can read my solution in this post 1 Link to comment Share on other sites More sharing options...
alqo Posted June 21, 2019 Share Posted June 21, 2019 On 7/26/2016 at 3:12 AM, rocky said: protected function processSubmitAccount() { if (Tools::getValue('passwd') != Tools::getValue('confirm')) { $this->errors[] = Tools::displayError('Password and confirmation do not match'); } parent::processSubmitAccount(); } hello thanks I got the codes I get the white page error when everything makes it mandatory alone only there is error in the codes Link to comment Share on other sites More sharing options...
alqo Posted June 21, 2019 Share Posted June 21, 2019 (edited) On 7/26/2016 at 3:12 AM, rocky said: Find the following code in themes/default-bootstrap/authentication.tpl at about line 492: <div class="required password form-group"> <label for="passwd">{l s='Password'} <sup>*</sup></label> <input type="password" class="is_required validate form-control" data-validate="isPasswd" name="passwd" id="passwd" /> <span class="form_info">{l s='(Five characters minimum)'}</span> </div> and then change it to: <div class="required password form-group"> <label for="passwd">{l s='Password'} <sup>*</sup></label> <input type="password" class="is_required validate form-control" data-validate="isPasswd" name="passwd" id="passwd" /> <span class="form_info">{l s='(Five characters minimum)'}</span> </div> <div class="required password form-group"> <label for="passwd">{l s='Confirmation'} <sup>*</sup></label> <input type="password" class="is_required validate form-control" data-validate="isPasswd" name="confirm" id="confirm_passwd" onblur="if ($(this).val() == $('#passwd').val()) $(this).parent().attr('class', 'required password form-group form-ok'); else $(this).parent().attr('class', 'required password form-group form-error');" /> </div> This will add a new "Confirmation" field that will turn red if the customer leaves the field and the value it doesn't match the "Password" field. If the passwords match, it will turn green. You'll also need to create override/controllers/front/AuthController.php with the following to prevent an account being created when the passwords don't match: <?php class AuthController extends AuthControllerCore { protected function processSubmitAccount() { if (Tools::getValue('passwd') != Tools::getValue('confirm')) { $this->errors[] = Tools::displayError('Password and confirmation do not match'); } parent::processSubmitAccount(); } } This will display a "Password and confirmation do not match" error message if a customer clicks the "Register" button when the passwords don't match. Remember to go to Advanced Parameters > Performance and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override. Prestashop 1.6 controllers/front/AuthController.php protected function processSubmitAccount() just below // Check if password matches confirmation if (Tools::getValue('passwd') != Tools::getValue('confirm')) $this->errors[] = Tools::displayError('Password confirmation does not match password !', false); white page error area solution buukadar .. I would appreciate if our friend collects this error Edited June 21, 2019 by alqo (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now