Auto-generated Password

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

By gversion - April 4, 2012

Hello,

When a new user registers for an account my Membership plug-in currently emails them a very long auto-generated password. This is great, however it looks to be unnecessarily long!

Is there any where I can change how many characters the password is? Ideally I'd like it to be about 5 characters in length ,whereas currently it is about 20.

Thank you,
Greg

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: [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