In Magento 2, the error “You did not sign in correctly or your account is temporarily disabled” is one of the most disturbing error because it happens even with a fresh installation of Magento 2. You will see this error even when you typed user name and password correctly. Some users told me that they even see this error after resetting the password.
I found out that there’re many Magento 2 users encounter this error but they couldn’t find a working solution. In this tutorial, I will explain everything about this error, the cause of the error and how to fix it. (currently working with Magento 2.1.x, Magento 2.2.x, Magento 2.3.x, Magento 2.4.x)
Cause of the error
This error occurs due to Magento 2’s security system. Magento 2 will temporarily disable accounts that do not meet it’s password complexity requirements.
By default, in Magento 2, the password that meets security requirement must consist of:
- Uppercase letters
- Lowercase letters
- Digits
- Special characters
- Minimum of 8 characters in length
(we can change this rule later in backend)
The error happens because the default admin password you set when installing Magento 2 didn’t meet system’s requirement => The system disabled the account for security purpose.
Solution
#Method 1: Unlock admin account
Connect to your server using ssh protocol and use the following command syntax to unlock admin account
Assuming that your magento 2 folder is located in /var/www/html
cd /var/www/html php bin/magento admin:user:unlock YOUR-ADMIN-USER-NAME
This command will also unlock your disabled admin account because of multiple incorrect login attempts
If you suceed, the output message from Magento 2 system will be:
The user account "magentip" has been unlocked
Now you can log into Magento 2 normally
#Method 2: Reset admin account password/username
With Magento 2 CLI command, you can also reset account login credentials or create a new account.
To create a new admin account use this syntax
bin/magento admin:user:create --admin-firstname="magentip" --admin-lastname="demo" --admin-email=magentip@gmail.com --admin-user=magentip --admin-password=Qwe@123456
Change the following information
- admin-user: Your admin username
- admin-password: new password (should be at least 7 letters with upper+lower cases, number, symbols)
- admin-email: your admin email
- admin-firstname: first name
- admin-lastname: last name
If you suceed, the output will be:
Created Magento administrator user named magentip
Now you can login to Magento 2 with the newly created account and change password of your “faulty” account
You can also change password of the existing account using that command.
For example, the email/username of the account that you cannot login is magentip and magentip@gmail.com => the syntax we use to update password of this account should be:
bin/magento admin:user:create --admin-firstname="magentip" --admin-lastname="demo" --admin-email=magentip@gmail.com --admin-user=magentip --admin-password=Newp@ssword
With –admin-password= “your new password that meets security requirement”.
Using that syntax will change your old password to Newp@ssword, which is eligible. Now you can login to Magento 2 normally without seeing the error: You did not sign in correctly or your account is temporarily disabled
Note: if the account does not exist, Magento will return this message:
Couldn't find the user account "magentip"
You will need to double check account details
#Method 3: Changing admin password using Mysql command
Go to PHPmyadmin on your server and select your Magento 2 database.
After that use this syntax to change Magento 2 password using Mysql command
SET @salt = MD5(UNIX_TIMESTAMP());
UPDATE admin_user SET password = CONCAT(SHA2(CONCAT(@salt, 'NewP@ssword'), 256), ':', @salt, ':1') WHERE username = 'Yourusername';
NewP@ssword
with your desired password (must meet Magento 2 security requirement)Yourusername
with your admin account username
After running the command above, your admin account will be updated with the new password you set in CONCAT(SHA2(CONCAT(@salt, 'NewP@ssword'), 256)
Now you can login to your account normally
Alternatively, you can ssh to your server, access MySQL database and use that syntax. You can find step-by-step how to use MYSQL command using ssh in this tutorial
Conclusion
In most case, I can resolve the error “You did not sign in correctly or your account is temporarily disabled” after unlock account using Magento 2 CLI.
If the 1st method does not work for you, try the 2nd method (create new admin account then reset password of your current account) or the 3rd method (changing password using MYSQL).
If none of the mentioned methods works for you, just drop a comment below and describe the error you got. I will try to help you fix it.
3 Comments
Hi Tran,
I did all these steps but I am still getting the same error with Magento Open Source 2.4.2
Mohan
Did you try to create a new admin account?
Hi , I have tried a new account , tried unblocking , nothing works….