pranab13 Posted September 7, 2017 Share Posted September 7, 2017 Hello, Does someone know how to remove some characters from the password generated by Prestashop when doing "Forgot your password ?". I thought it was on the class Tools.php on the passwdGen function but it doesn't seem to work. Is it somewhere else ? Regards. Link to comment Share on other sites More sharing options...
Scully Posted September 8, 2017 Share Posted September 8, 2017 You might want to say which prestashop version you are asking for .... Link to comment Share on other sites More sharing options...
beoutside Posted September 8, 2017 Share Posted September 8, 2017 Sorry! I forgot on this thread! Prestashop 1.6.1.10 Link to comment Share on other sites More sharing options...
Scully Posted September 8, 2017 Share Posted September 8, 2017 The front controller PasswordController.php calls this: $customer->passwd = Tools::encrypt($password = Tools::passwdGen(MIN_PASSWD_LENGTH, 'RANDOM')); If you have written an override, you needed to delte cache/class_index.php before the override takes effect. Link to comment Share on other sites More sharing options...
beoutside Posted September 8, 2017 Share Posted September 8, 2017 Thank you. So it calls the RANDOM case in the Tools class I saw. I'm not that advanced in coding for this bit of code : case 'RANDOM': $num_bytes = ceil($length * 0.75); $bytes = self::getBytes($num_bytes); return substr(rtrim(base64_encode($bytes), '='), 0, $length); Do you know how I can change it so it removes these letters? I'm going to try and figure out but if ever you have the answer that would be great! Link to comment Share on other sites More sharing options...
pranab13 Posted September 8, 2017 Author Share Posted September 8, 2017 (edited) I think I found it! I just invented that case and it works! And I've replaced RANDOM by INVENTED on the PasswordController.php case 'INVENTED': $str = 'ABCDEFGHJKMNPQRSTUVWXYZ23456789abcdefghjkmnpqrsuvwxyz'; break; Edited September 8, 2017 by pranab13 (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted September 8, 2017 Share Posted September 8, 2017 Sounds good. Pls add SOLVED to topic title if your problem is solved. Link to comment Share on other sites More sharing options...
pranab13 Posted September 8, 2017 Author Share Posted September 8, 2017 Ok, I waited for your answer in case it wasn't good. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now