Updated on Sep 12, 2016
It happens from time to time for the admin password to be lost or even forgotten. In such cases the store owners are usually struggling to get the password reset and trying whatever they can find over the web without an actual guarantee that the method they have found will result in a successful password reset.
In the next few lines of this tutorial we will not only show you how to reset the admin password for your store but also we will guarantee that the described methods will be 100% functional and more importantly they will result in a successful password change.
The most common and native way of changing the password for your admin account is via the Lost Password feature provided by PrestaShop 1.6. This feature is available on the login screen of the admin area for your Store or the so called Back Office.
If you click on the Lost Password link you will be presented with a simple form where you will need to enter the email account you are using for the admin user and then if you click on the Send button the PrestaShop 1.6 application will send you the new password generated for your account directly on that email account.
Once received you will be able to login immediately with that password into the Back Office of your online Store.
The second method you can consider for changing the current password of your Store is via direct edit of the password field in the employees table. Let's review that process in details now.
The way how PrestaShop stores the password is by encrypting two strings with MD5 function ending up in a single MD5 encrypted string being inserted in the password field of the database. Your goal here is to change that string to the correct one which will be valid for your new password.
In order to achieve that you will need of course to take the first part of the string. It can be found in the
settings.inc.php file which is located inside the config of your store.
Once you find that file you will need to take the value of the "
_COOKIE_KEY_" variable which is a long, random generated string. For example if the whole definition line is:
the string you need to use is:
Assuming that you have obtained this string it is now the time to use it in the database of your Store. In order to access the database you will need to located the phpMyAdmin application in the cPanel service.
Then you will need to find the database used by your application and once this is done to locate the
ps_employee table. Note that the prefix (
ps_) depends on the actual prefix you have used for the database when you have installed the application initially. In that table you will be able to see all the admin accounts granted with access to your website. Please find the one you would like to change the password for and edit the row via the Edit button.
On the next page you will need to find the passwd field where the actual password is kept. From the function drop-down you will need to choose MD5 and once this is done you will need to construct the string which will be converted to your new password.
This is relatively easy as you will need to concatenate the "
_COOKIE_KEY_" string which you have obtained earlier in this tutorial and your actual new password. For example let's use the "pass123" as the new password for the admin account. In that case the text you will need to enter in the value for the passwd field is:
Note how the new password is simply added to the cookie key you have obtained previously. The only thing remaining is for you to press the Go button so the query against your MySQL database can be executed and for the new password to be setup. Now you can access the admin dashboard of your store and to login with the new password you have set.
Congratulations! You can now reset the password for the Back Office of your PrestaShop 1.6 based Online Store.