Auto-generated Password

5 posts by 2 authors in: Forums > CMS Builder
Last Post: April 4, 2012   (RSS)

Re: [gversion] Auto-generated Password

By (Deleted User) - April 4, 2012

Hi Greg,

In the user-signup.php script check out line 48 (starting $password = ...).

This is where the password is generated, with the string length set '15' normally. Simply replace the integer at the end of the function with whatever number suits.

If your signup script is different, just search for the first instance of '$password' and you should find it.

Let me know if that helps,

Tom

Re: [Tom P] Auto-generated Password

By gversion - April 4, 2012

Hi Tom,

Thanks for the quick reply.

I couldn't find the exact line you stated but I changed the number to 5 and then signed up again and the password I received was 27 characters long...

This is the line of code I changed:

$_REQUEST['password'] = substr(md5(uniqid(rand(), true)), 5); // example output: c5560251ef0b3eef9



Does it need to be changed any where else?

Thanks,
Greg

Re: [gversion] Auto-generated Password

By (Deleted User) - April 4, 2012

Hi Greg,

I need more coffee - I forgot to tell you to add a '0,' before the length of the string you wanted.

substr() takes the string (in this case, the md5 encoded uniqid() then the start position ('0' is the beginning), then the length you want.

So, what you want is :
$_REQUEST['password'] = substr(md5(uniqid(rand(), true)),0 , 5);
for a five character password.

Let me know if that helps,

Tom

Re: [Tom P] Auto-generated Password

By gversion - April 4, 2012

Hi Tom,

That's done the job!

Thanks,
Greg