I have clicked on the link for "Forgotten Password" but I never receive an email with the link to reset the password. I have checked my junk folder but nothing gets sent to me. Is there another way to get a new password for the back office? The email address on Magento is correct.
-
you need a new password for the user or an admin account?– sebMar 12, 2015 at 12:04
-
What Version? Where are you doing your reset from? Did it suddenly start or has it always happened? Do you transactional emails work? Did you recently upgrade?– brentwpetersonMar 12, 2015 at 12:25
-
don't have enough reputation to comment, but I just wanted to say that Marius solution worked for me Magento 1.7.0.2, thank you. comment by`lazy_coder"– Amit Bera ♦Oct 11, 2017 at 8:35
3 Answers
If you have shell (ssh) access to your installation you could use n98-magerun (see https://github.com/netz98/n98-magerun#installation how to install magerun) to reset the password. After installation use the following command to reset the admin password:
[path to/]n98-magerun.phar admin:user:change-password [username]
Then enter the new password, after this you should be able to login again.
I don't have a solution for getting a new password, but I can offer you one to create a new admin account via code. Then you can use that to change the password to your main account or you can adapt it to change your password instead of creating a new admin user.
create a new file called adminuser.php
on the same level as index.php
with this content
<?php
error_reporting(E_ALL | E_STRICT);
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app();
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$username = 'yourUsername';//desired username
$firstname = "Firstname";//desired firstname
$lastname = "Lastname";//desired lastname
$email = "[email protected]";//desired email
$pass = 'yourPaSSWordHere';//desired password
$user = Mage::getModel('admin/user')->load($username, 'username');
if ($user->getId()){
echo "User {$username} already exists";
exit;
}
$user->setUsername($username)
->setFirstname($firstname)
->setLastname($lastname)
->setEmail($email)
->setPassword($pass)
;
$result = $user->validate();
if (is_array($result)){
foreach ($result as $res){
echo $res."\n";
}
exit;
}
try{
$user->setForceNewPassword(true);
$user->save();
$user->setRoleIds(array(1))->saveRelations();
echo "User {$username} was created";
exit;
}
catch (Exception $e){
echo $e->getMessage();
}
then just call in the browser MAGENTO_ROOT/adminuser.php
.
Maybe you've just the wrong e-mail address registered in the database for that account. Or wrong e-mail settings for your store(than no mail can be send at all)
If you have database access by phpmyadmin or a similar tool you could change the password by reseting it manually.
Goto the table admin_user
and edit your user, save the password in md5('new password') en viola you can use the new password.