Jump to content

Default Creation Password Requirements


CCSupport

Recommended Posts

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

Link to comment
Share on other sites

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 by CCSupport
Clarification
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 8 years later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated