Skip to content

Instantly share code, notes, and snippets.

@brodkin
Last active December 19, 2015 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brodkin/5891699 to your computer and use it in GitHub Desktop.
Save brodkin/5891699 to your computer and use it in GitHub Desktop.
Magento Force Customer Login With Password
Mage::app("default");
// Set the variables that we care about.
$storeId = 1;
$username = 'their.email@their.domain.com';
$password = 'theirpassword';
try{
$authenticated = Mage::getModel('customer/customer')
->setWebsiteId($storeId)
->authenticate($username, $password);
} catch ( Exception $e ) {
$authenticated = false;
}
// Do something depending on whether $authenticated is truthy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment