Jump to content

[solved] how to add the Password Confirm field


Recommended Posts

Hi!,

I'm trying to insert the field "confirm password" to the customer record.

I found some solutions on this forum, but have not worked.

Do you have any suggestions?

 

Using Prestashop 1.5.4, as always sorry for my English.

 

thanks

Link to comment
Share on other sites

Try this :

 

In authentication.tpl

after

  	 <p class="required password">
           <label for="passwd">{l s='Password'} <sup>*</sup></label>
           <input type="password" class="text" name="passwd" id="passwd" />
           <span class="form_info">{l s='(Five characters minimum)'}</span>
       </p>

add

  	 <p class="required password">
           <label for="confirm_passwd">{l s='Confirm password'} <sup>*</sup></label>
           <input type="password" class="text" name="confirm_passwd" id="confirm_passwd" />
       </p>

 

Do the same in order-opc-new-account.tpl (for "One page checkout" mode)

 

In AuthController.php

after

  	 // Checked the user address in case he changed his email address
       if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email))
           if (Customer::customerExists($email))
               $this->errors[] = Tools::displayError('An account using this email address has already been registered.', false);

add

  	 // Check if password matches confirmation
       if (Tools::getValue('passwd') != Tools::getValue('confirm_passwd'))
               $this->errors[] = Tools::displayError('Password confirmation does not match password !', false);

 

This should work !

 

But best practice would be to create an override of AuthController instead of modifying the core file... ;)

  • Like 3
Link to comment
Share on other sites

You're welcome :)

 

Notice that the same model could be used for email, and also we could add this on the new input field to avoid copy/paste

autocomplete="off" onpaste="return false;" oncopy="return false;" oncontextmenu="return false;"

  • Like 1
Link to comment
Share on other sites

Try this :

 

In authentication.tpl

after

  	 <p class="required password">
		<label for="passwd">{l s='Password'} <sup>*</sup></label>
		<input type="password" class="text" name="passwd" id="passwd" />
		<span class="form_info">{l s='(Five characters minimum)'}</span>
	</p>

add

  	 <p class="required password">
		<label for="confirm_passwd">{l s='Confirm password'} <sup>*</sup></label>
		<input type="password" class="text" name="confirm_passwd" id="confirm_passwd" />
	</p>

 

Do the same in order-opc-new-account.tpl (for "One page checkout" mode)

 

In AuthController.php

after

  	 // Checked the user address in case he changed his email address
	if (Validate::isEmail($email = Tools::getValue('email')) && !empty($email))
		if (Customer::customerExists($email))
			$this->errors[] = Tools::displayError('An account using this email address has already been registered.', false);

add

  	 // Check if password matches confirmation
	if (Tools::getValue('passwd') != Tools::getValue('confirm_passwd'))
			$this->errors[] = Tools::displayError('Password confirmation does not match password !', false);

 

This should work !

 

But best practice would be to create an override of AuthController instead of modifying the core file... ;)

 

It works! You're the best! Thank you!

 

p.s. i've created authcontroller.php in ovverride/front/ :)

  • Like 1
Link to comment
Share on other sites

  • 11 months later...

Thanks for this information. Can you tell me what should i do for the phrase "'Password confirmation does not match password  " appears in the translation backoffice options?

 

(sorry for my english)

 

cumps

 

[solve]

Edited by dfml (see edit history)
Link to comment
Share on other sites

  • 4 months later...
  • 8 months later...
  • 4 months later...

This does not appear to work in latest version 1.6.1.4

 

Tried it (modified) for registration email and is allowing registration with different emails in fields.

 

Has anyone got code that works in 1.6.1 and later?

 

Thanks

Baz 

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...