Allows to implement custom customer authentication scenarios.
By default when a customer submits the Login form, LemonStand checks the specified email
and password values against the content of the
shop_customers database table. In
the event handler you can use submitted data for custom record search.
The handler method should return the customer object (
Shop_Customer), NULL or FALSE.
The FALSE value is considered as a failed authentication. If the NULL value is returned, the
standard authentication code runs.
Usage example:
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onAuthenticateCustomer', $this, 'find_customer');
}
public function find_customer($login, $password)
{
return Shop_Customer::create()
->where('x_customer_profile_id=?', $login)
->where('password=?', Phpr_SecurityFramework::create()->salted_hash($password))
->find();
}