webmachine Posted March 10, 2018 Share Posted March 10, 2018 Hello to all, I created a user registration form for the BackOffice that records, in fact, users and goes to compile also other personal tables in the database. Now I find myself with a problem, the scure_key field in the ps_customer table. How can I generate the string secure_key? I was hoping for something like the password that is generated by encrypting in MD5 the queuing of COOKIE_KEY + Password but ... apparently not. It seems that without this key the user can not make orders, in fact by mistake. I await your thank you so much PS version: 1.7 Link to comment Share on other sites More sharing options...
jgamio Posted March 11, 2018 Share Posted March 11, 2018 You can check the Prestashop code go to classes/Customer.php then look on the add part Link to comment Share on other sites More sharing options...
webmachine Posted March 11, 2018 Author Share Posted March 11, 2018 6 ore fa, jgamio dice: You can check the Prestashop code go to classes/Customer.php then look on the add part Hi, Thank you for your answer. I checked, but I can't understand how ps generate it... At line 242 you can see this: $this->secure_key = md5(uniqid(rand(), true)); But if I insert this string into my personal code doesn't work for Prestashop... This sim a random string in MD5... How prestashop check is correct if is random? Link to comment Share on other sites More sharing options...
jgamio Posted March 11, 2018 Share Posted March 11, 2018 Sorry I am lost about what do you need Maybe I am wrong but these is just an internal code to use for example to validate an Order , that is why is a ramdom Where do you got errors ? Link to comment Share on other sites More sharing options...
webmachine Posted March 11, 2018 Author Share Posted March 11, 2018 35 minuti fa, jgamio dice: Sorry I am lost about what do you need Maybe I am wrong but these is just an internal code to use for example to validate an Order , that is why is a ramdom Where do you got errors ? Sometimes the payment fail and PS show and error. But the user that I created with my method can't see category as attached, the user that I create trought PS form in BackOffice don't have this problem. The red message says "You don't have access to this category" Link to comment Share on other sites More sharing options...
jgamio Posted March 11, 2018 Share Posted March 11, 2018 (edited) Did you set the customer to some group ? check if the users you created have a group Edited March 11, 2018 by jgamio add picture (see edit history) Link to comment Share on other sites More sharing options...
webmachine Posted March 11, 2018 Author Share Posted March 11, 2018 (edited) No, the customers are all in the same group... But if I create the suer with my form it doesn't work and if I use PrestaShop all is fine. I'll send you ps_customer difference from user created with my form and with prestashop. Do you need also my registration code? Edited March 11, 2018 by webmachine (see edit history) Link to comment Share on other sites More sharing options...
webmachine Posted March 11, 2018 Author Share Posted March 11, 2018 Ok, I checked... The user have a group but when I create user with my form it can't see category, if I go to Customer--> on BO, open the user created and click SAVE... The user can see the category. On db the only field that change after saving is Password. Password before saving: 17b6c299ef10e8d9f1a5f455010ee710 Password afert saving: $2y$10$YI.BuNSyb.LMvPba.4c/DucgJEXpFNtNg2rS/18ZHpp52UU2/GZhi PS crypt the psw again... Why? How can I crypt with the same method But in both cases the user can login, the password "change" but remain the same for PS. Link to comment Share on other sites More sharing options...
jgamio Posted March 12, 2018 Share Posted March 12, 2018 No is the password Check the category class on the checkAccess Maybe is a cache problem but nothing to do with the password Link to comment Share on other sites More sharing options...
webmachine Posted March 12, 2018 Author Share Posted March 12, 2018 10 ore fa, jgamio dice: Check the category class on the checkAccess Hi, what do you mean? Where I can check? Why there is this category problem? How can I solve? Thank you Link to comment Share on other sites More sharing options...
jgamio Posted March 12, 2018 Share Posted March 12, 2018 You need check why you got the Non hai accesso a questa categoria You talk about the secury key or the password but you just doing guess 1- Go to the Categoty Controller on the init you got a checkaccess function to the class 2- Go to the Category class search checkaccess function The function dont use the password or the secure key but there you can see the query just check agains your data to find the problem Link to comment Share on other sites More sharing options...
webmachine Posted March 12, 2018 Author Share Posted March 12, 2018 9 minuti fa, jgamio dice: 1- Go to the Categoty Controller Hi, I found $customer_access, the file says this: /** @var bool If set to false, customer cannot view the current category. */ public $customer_access = true; Now... Where is set $customer_access ? What is? Link to comment Share on other sites More sharing options...
peorthyr Posted July 31, 2020 Share Posted July 31, 2020 Just for the future users, we had a problem since some users cannot end the order process due to secure_key been null, this happens because those users where updated using webservices and the secure key was overwritten by the PUT method. I've managed to create a secure_key using this mysql query: update ps_customer set secure_key=MD5(RAND()) where secure_key = ''; 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