Migrate customers table from MijoShop to OpenCart 3

When we migrate customers from MijoShop to OpenCart there is a little problem: the methods to hash passwords are different and thus when our customers try to login the passwords do not match. In this post I will show you how to migrate and fix the problem. ...

June 2, 2019 · 12 min · 2419 words · Parzibyte

Reset OpenCart user password manually (in database)

Today we will see how to reset the OpenCart password (e-commerce system in PHP) manually, directly in the database; generating the hash and the salt manually with a function created by me. Function that generates salt and new password Here I leave the code, and the explanation at the end. <?php function token($length = 32) { // Create random token $string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $max = strlen($string) - 1; $token = ''; for ($i = 0; $i < $length; $i++) { $token .= $string[mt_rand(0, $max)]; } return $token; } function generar_pass($passTextoPlano){ $sal = token(9); $hash = sha1($sal . sha1($sal . sha1($passTextoPlano))); return [ "sal" => $sal, "hash" => $hash, ]; } // Demostrar uso $datosPass = generar_pass("hunter2"); $pass = $datosPass["hash"]; // Este va en el campo password $sal = $datosPass["sal"]; // Este va en el campo salt printf("La sal es %s y la pass es %s", $sal, $pass); The function returns an array that has the salt and the password, the way to call it is to pass the password in plain text. ...

June 2, 2019 · 2 min · 359 words · Parzibyte