How to change or reset the Prestashop administrator password

By | October 5, 2017

How to change or reset the Prestashop administrator password,New better way to reset admin password,Resetting the PrestaShop administrator password,Reset Prestashop password for admin account

Usually the passwords in web projects are stored in the database in an encrypted form in a hash format. With this we avoid keeping these passwords clear. The encryption algorithm is also usually quite basic, applying an MD5 or similar.

How to change or reset the Prestashop administrator password

In some projects, however, they add some complexity by adding an additional value to the encryption formula. It is the case of Prestashop that from its origins uses a string defined in the file config / settings.php. This variable is defined in that file as _COOKIE_KEY_

When we want to reset or modify the passwords we need to regenerate the hashes that are stored in the databases. In the case of Prestashop we must incorporate the value mentioned above.

In projects that often move cloning the production environment in a development environment for the purpose of making extensions. And many times you need to be able to login with several users with different roles, among them the administrator , the rest of employees or the client users . The most comfortable way I’ve found working is to reset or change all passwords to the same value.

I attached a script that I have prepared to facilitate the latter. It is very intuitive. If you copy it to the config directory and run it from console or URL, it will change all the passwords to the one defined in the $ passwd variable

<? php require_once 'settings.inc.php'; $ link = mysqli_connect (_DB_SERVER_, _DB_USER_, _DB_PASSWD_, _DB_NAME_); if (! $ link) { die ('Connect Error ('. mysqli_connect_errno (). ')' . mysqli_connect_error ()); } $ passwd = 'NoVaInternet'; $ md5 = md5 (_COOKIE_KEY_. $ passwd); $ link-> query ("UPDATE". _DB_PREFIX_. "employee SET passwd = '$ md5'"); 
$ link-> query ("UPDATE". _DB_PREFIX_. "customer SET passwd = '$ md5'");

mysqli_close ($ link); 
?>

Leave a Reply

Your email address will not be published. Required fields are marked *