2

I am trying to extend the authentication function, I have extended classes many times with out issue but this ha stumped me

app/etc/modules/Dev_Customer.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Dev_Customer>
            <active>true</active>
            <codepool>local</codepool>
        </Dev_Customer>
    </modules>
</config>

app/code/local/Dev/Customer/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Dev_Customer>
            <version>0.1.0</version>
        </Dev_Customer>
    </modules>
    <global>
       <models>
          <customer>
              <rewrite>
                  <customer>Dev_Customer_Model_Customer</customer>
              </rewrite>
          </customer>
       </models>
    </global>
</config>

app/code/local/Dev/Customer/Model/Customer.php

<?php
class Dev_Customer_Model_Customer extends Mage_Customer_Model_Customer{

    /**
     * Authenticate customer
     *
     * @param  string $login
     * @param  string $password
     * @throws Mage_Core_Exception
     * @return true
     *
     */

    public function authenticate($login, $password)
    {
        $this->loadByEmail($login);
        if (!$this->getId()) {
            throw Mage::exception('Mage_Core', Mage::helper('customer')->__('Please re-register as your email address cannot be found, sorry.'),
                self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD
            );

        }

        if ($this->getConfirmation() && $this->isConfirmationRequired()) {
            throw Mage::exception('Mage_Core', Mage::helper('customer')->__('This account is not confirmed.'),
                self::EXCEPTION_EMAIL_NOT_CONFIRMED
            );
        }

        if (!$this->validatePassword($password)) {
            throw Mage::exception('Mage_Core', Mage::helper('customer')->__('Invalid login or password.'),
                self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD
            );
        }
        Mage::dispatchEvent('customer_customer_authenticated', array(
           'model'    => $this,
           'password' => $password,
        ));

        return true;
    }
}

It is just not being called, I have flushed the cache, checked, double checked etc.. nothing I do seems to help.

I am running Magento 1.9.1.0 CE

I am sure it is something silly but for the life of me I cannot figure it out.

I have migrated from another platform and I need to let customers who did not get migrated they need to re-register, the aim is to do this automatically once I get past this hurdle.

2

You have do small mistake:

at app/etc/modules/Dev_Customer.xml , codepool should be codePool.p should Uppercase Letter (P).

This is magento pattern

  • OMG! How did I miss that! I have written huge amounts of modules. Thank you – Darren Jun 22 '16 at 18:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.