CCSupport Posted September 17, 2015 Share Posted September 17, 2015 Hello all, I am pretty sure we have dealt with this before, however I cannot find any local documentation...so...here goes: How can we change the auto-generated password requirements when an order is ready to run? So, we have an order and it auto-generates a random password for a cPanel account, however that password does not meet our cPanel password requirements so we have to manually change it. I am guessing this is within the module or some syntax within WHMCS...however, I cannot find where! Any guidance would be appreciated. Just to note, this is using v5.3.14 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 17, 2015 Share Posted September 17, 2015 i'm not sure anything has changed since the post below... http://forum.whmcs.com/showthread.php?91534-strong-password-for-new-account&p=385447#post385447 0 Quote Link to comment Share on other sites More sharing options...
CCSupport Posted September 17, 2015 Author Share Posted September 17, 2015 (edited) Thanks Brian. I am pretty shocked that the auto-generated passwords are so insecure. I would have hoped with a system that holds client data we would be able adjust to make them secure from the admin level without manually changing every client that signs up. Unfortunately I keep on being surprised. However, as always, thanks for the info though Brian. EDIT: Just to edit this...using 100 on the password strength field just isn't secure enough nowadays. Edited September 17, 2015 by CCSupport Clarification 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted September 18, 2015 Share Posted September 18, 2015 Why don't you just use PreModuleCreate hook to create your own password? Something like this: function GeneratePassword($length = 10, $add_dashes = false, $available_sets = 'luds') { $sets = array(); if(strpos($available_sets, 'l') !== false) $sets[] = 'abcdefghjkmnpqrstuvwxyz'; if(strpos($available_sets, 'u') !== false) $sets[] = 'ABCDEFGHJKMNPQRSTUVWXYZ'; if(strpos($available_sets, 'd') !== false) $sets[] = '23456789'; if(strpos($available_sets, 's') !== false) $sets[] = '!@$%&?'; $all = ''; $password = ''; foreach($sets as $set) { $password .= $set[array_rand(str_split($set))]; $all .= $set; } $all = str_split($all); for($i = 0; $i < $length - count($sets); $i++) $password .= $all[array_rand($all)]; $password = str_shuffle($password); if(!$add_dashes) return $password; $dash_len = floor(sqrt($length)); $dash_str = ''; while(strlen($password) > $dash_len) { $dash_str .= substr($password, 0, $dash_len) . '-'; $password = substr($password, $dash_len); } $dash_str .= $password; return $dash_str; } You only have to call GeneratePassword() function to get your awesome password in the PreModuleCreate hook point. 0 Quote Link to comment Share on other sites More sharing options...
UpGrad3 Posted March 7 Share Posted March 7 Hello, Newbie here, dealing with the same issue. Need to increase the auto generated username and password character length from 10 to 12 whenever a new order is placed (hope this makes sense). Again, I am very new to all of this and don't really understand the above solution. Was wondering if anyone who is kind enough (and patient) could help me understand the above. If there are step by step instructions available, I wouldn't mind trying on my own. Appreciate your time. Thank you. 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.