Home > Blog > Recover a Lost Password on a Local Magento Site

Recover a Lost Password on a Local Magento Site

Posted by Derek on December 31, 2014

This should, obviously, only be done on a local development site and not in a production environment. If you're like me you have a lot of development sites and databases. Occasionally I'll come back to one and for one reason or another not know the password. This is a quick and easy way to recover it by temporarily setting the admin console log in page to automatically authenticate you.

Go to the login page template at `app/design/admin/default/template/login.phtml`. Anywhere on the page add the follow line:

<?php setUser( Mage::getModel('admin/user')->loadByUsername('ADMIN') ); ?>

Replace `ADMIN` with your username. Visit the login page then refresh it again and you’ll be logged in. Change the password, unlock the account if needed then make sure to remove the code from the login template.

Leave a Reply

(Your email will not be publicly displayed.)

Captcha Code

Click the image to see another captcha.