Jluis Posted December 4, 2018 Share Posted December 4, 2018 Bonjour , je voudrais afficher une deuxième input de confirmation de mot de passe lors de la création d'un nouveau compte . suffit t-il de dupliquer l'input de mot de passe et tester si les deux valeurs sont égaux ?? Merci d'avance Link to comment Share on other sites More sharing options...
stevent Posted March 21, 2019 Share Posted March 21, 2019 Bonjour, avez vous réussi à faire celà ? merci Link to comment Share on other sites More sharing options...
Gaspacho Posted May 2, 2019 Share Posted May 2, 2019 Bonjour, Je me permets de remonter ce topic, car je suis également interessé par une solution de confirmation de mot de passe. Si quelqu'un a une idée sur le sujet Merci Link to comment Share on other sites More sharing options...
stevent Posted May 3, 2019 Share Posted May 3, 2019 (edited) Hello tout le monde, voici la solution : Fichiers : /classes/form/CustomerFormatter.php /classes/form/CustomerForm.php Ouvrir CustomerFormatter.php et chercher $format['email'] = (new FormField()) au dessus de if ($this->ask_for_new_password) { $format['new_password'] = (new FormField()) ->setName('new_password') ->setType('password') ->setLabel( $this->translator->trans( 'New password', [], 'Shop.Forms.Labels' ) ) ; } mettre : $format['conf_password'] = (new FormField) ->setName('conf_password') ->setType('password') ->setLabel( $this->translator->trans( 'Confirm password', [], 'Shop.Forms.Labels' ) ) ->setRequired(true) ; ensuite CustomerForm.php et chercher public function validate() après le code : $emailField = $this->getField('email'); $id_customer = Customer::customerExists($emailField->getValue(), true, true); $customer = $this->getCustomer(); if ($id_customer && $id_customer != $customer->id) { $emailField->addError($this->translator->trans( 'The email is already used, please choose another one or sign in', array(), 'Shop.Notifications.Error' )); } mettre : //Confirm password - check if is the same $passwField = $this->getField('password'); $confPasswField = $this->getField('conf_password'); $passwordValue = $passwField->getValue(); $confPasswValue = $confPasswField->getValue(); if ($passwordValue != $confPasswValue) { $confPasswField->addError($this->translator->trans( "The password and the confirmation password don't match", array(), 'Shop.Notifications.Error' )); } ensuite mettre les fichiers dans : /override/classes/form/ VIDER LE CACHE Edited May 3, 2019 by stevent (see edit history) 1 2 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