Jump to content

PrestaShop error Invalid email/password combination - not able to register


Edge_jr

Recommended Posts

 

This problem can be fixed by commenting condition check in file location psrootfolder/classes/form/CustomerPersister.php


 

private function update(Customer $customer, $clearTextPassword, $newPassword, $passwordRequired = true)
    {
        /*
        if (!$customer->is_guest && $passwordRequired && !$this->crypto->checkHash(
            $clearTextPassword,
            $customer->passwd,
            _COOKIE_KEY_
        )) {
            $msg = $this->translator->trans(
                'Invalid email/password combination',
                [],
                'Shop.Notifications.Error'
            );
            $this->errors['email'][] = $msg;
            $this->errors['password'][] = $msg;

            return false;
        }
    */

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

You can edit zip code format for every country separately in B.O. under International -> Locations -> Countries tab -> select country and then you see "Zip/postal code format".

You can also disable this validation in /classes/Validate.php, method "isZipCodeFormat()". But better would be to override Validate class and change isZipCodeFormat() method there (https://devdocs.prestashop.com/1.7/modules/concepts/overrides/)

zip.png

Link to comment
Share on other sites

 

This problem can be fixed by commenting condition check in file location psrootfolder/classes/form/CustomerAddressForm.php
 

public function validate()
{
    $is_valid = true;
    /*
    if (($postcode = $this->getField('postcode'))) {
        if ($postcode->isRequired()) {
            $country = $this->formatter->getCountry();
            if (!$country->checkZipCode($postcode->getValue())) {
                $postcode->addError($this->translator->trans(
                    'Invalid postcode - should look like "%zipcode%"',
                    array('%zipcode%' => $country->zip_code_format),
                    'Shop.Forms.Errors'
                ));
                $is_valid = false;
            }
        }
    }
    */

    if (($hookReturn = Hook::exec('actionValidateCustomerAddressForm', array('form' => $this))) !== '') {
        $is_valid &= (bool) $hookReturn;
    }

    return $is_valid && parent::validate();
}

 

Link to comment
Share on other sites

  • 6 months later...
On 10/18/2020 at 12:14 PM, Zohaib-fk said:

 

This problem can be fixed by commenting condition check in file location psrootfolder/classes/form/CustomerPersister.php


 


private function update(Customer $customer, $clearTextPassword, $newPassword, $passwordRequired = true)
    {
        /*
        if (!$customer->is_guest && $passwordRequired && !$this->crypto->checkHash(
            $clearTextPassword,
            $customer->passwd,
            _COOKIE_KEY_
        )) {
            $msg = $this->translator->trans(
                'Invalid email/password combination',
                [],
                'Shop.Notifications.Error'
            );
            $this->errors['email'][] = $msg;
            $this->errors['password'][] = $msg;

            return false;
        }
    */

 

It's working for me ! You are awesome Zohaib-fk Thank you very much

Link to comment
Share on other sites

  • 1 year later...
  • 3 months later...
  • 1 year later...
  • 7 months later...
Posted (edited)

I also had this error on Prestashop 8.2.1

The installation had Multishop enabled and the error showed up in only one of three shops.

Instead of commenting out the whole check, i inserted some echo lines to see the values that were used, this one being the crucial one:

private function update(Customer $customer, $clearTextPassword, $newPassword, $passwordRequired = true)
    {
        if (!$customer->is_guest && $passwordRequired && !$this->crypto->checkHash(
            $clearTextPassword,
            $customer->passwd,
            _COOKIE_KEY_
        )) {
            // next line only for testing, show customer id on page
            echo("\$customer->id: $customer->id<br>");
            $msg = $this->translator->trans(
                'Invalid email/password combination',
                [],
                'Shop.Notifications.Error'
            );
            $this->errors['email'][] = $msg;
            $this->errors['password'][] = $msg;

            return false;
        }

And it turned out the shown customer id was not null or something to expect for a new customer object (i don't know Prestashop internals), but the id of an already existing customer. So the "checkHash" function was comparing the password of an already existing user with the password entered in the registration form, which fails.

The "solution" was to delete the browser cookies for the domain of the shop. After doing that registration did work.

I guess there was some old session data in the cookies and somehow Prestashop used it (which i think it should not).

Maybe this is a symptom of a bug?

Edited by friendofprestashop
Mentioning multishop (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...