Andrea D. Posted October 15, 2021 Share Posted October 15, 2021 Hello, i need a PreModuleCreate that generate a strong password that will be used in virtualizor module. WHMCS Support provided me this hook but it gave this error https://imgur.com/AW82lbV <?php function hook_StrongPasswordGenerator($vars) { $password = substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-=+?'), 0, $length = '10'); } add_hook('PreModuleCreate', 1, function($vars) { return array( 'password' => $password, ); } ); 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted October 17, 2021 Share Posted October 17, 2021 The two should be combined or you should call hook_StrongPasswordGenerator within the hook. For example: add_hook('PreModuleCreate', 1, function($vars) { $password = substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-=+?'), 0, $length = '10'); return array( 'password' => $password, ); } ); 0 Quote Link to comment Share on other sites More sharing options...
Andrea D. Posted October 17, 2021 Author Share Posted October 17, 2021 7 minutes ago, steven99 said: The two should be combined or you should call hook_StrongPasswordGenerator within the hook. For example: add_hook('PreModuleCreate', 1, function($vars) { $password = substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-=+?'), 0, $length = '10'); return array( 'password' => $password, ); } ); Hello, thank you for your reply. I have tested this by uploading but it seems that it is not doing nothing.. https://imgur.com/G4WBzrM (order accept view) 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted October 18, 2021 Share Posted October 18, 2021 I don't think that hook saves the password to the service and thus why it does not show that. If you updated the service, either by model / class or API, with the password (in encrypted form), it should then save and show there. 0 Quote Link to comment Share on other sites More sharing options...
Andrea D. Posted October 18, 2021 Author Share Posted October 18, 2021 9 hours ago, steven99 said: I don't think that hook saves the password to the service and thus why it does not show that. If you updated the service, either by model / class or API, with the password (in encrypted form), it should then save and show there. I have tested it again with the creation of the VPS and i am getting as server password the one that i have choosen... https://imgur.com/QWic1iz Is there something i am missing? 0 Quote Link to comment Share on other sites More sharing options...
wsa Posted October 18, 2021 Share Posted October 18, 2021 Hi, We will be very happy to assist you with this project. Please contact us for any WHMCS development at https://www.whmcsservices.com/customwhmcs.php Hope to hear from your 0 Quote Link to comment Share on other sites More sharing options...
Andrea D. Posted October 19, 2021 Author Share Posted October 19, 2021 On 10/18/2021 at 2:56 PM, wsa said: Hi, We will be very happy to assist you with this project. Please contact us for any WHMCS development at https://www.whmcsservices.com/customwhmcs.php Hope to hear from your Made a ticket but no one is answering... 0 Quote Link to comment Share on other sites More sharing options...
Andrea D. Posted October 19, 2021 Author Share Posted October 19, 2021 On 10/18/2021 at 4:56 AM, steven99 said: I don't think that hook saves the password to the service and thus why it does not show that. If you updated the service, either by model / class or API, with the password (in encrypted form), it should then save and show there. would you be available to help me again ...? 0 Quote Link to comment Share on other sites More sharing options...
wsa Posted October 20, 2021 Share Posted October 20, 2021 21 hours ago, Andrea D. said: Made a ticket but no one is answering... Please check your email 🙂 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.