Jump to content

Edit History

alqo

alqo

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

alqo

alqo

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_passwd'))
                $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

×
×
  • Create New...