Jump to content

WHMCS Hooks: updating password and username with predefined ones


Recommended Posts

Good Day all,

 

I've stumbled upon few issues with my task.

 

We have a list of predefined usernames/passwords that we would like to use instead of system generated ones. When a user places an order, WHMCS generates username/password which can be seen on /clienthosting.php?userid=12&id=122 (Admin Page).

What I'm trying to do, is no replace system-generated user/pass pair and use the ones we have defined.

 

 

Can anyone advice me, which hook functions should I use, as I've tried to do it via module_CreateAccount function, and PreModuleCreate hook.

 

Is it possible to implement, or am I missing something?

 

Thanks in advance.

Link to comment
Share on other sites

you should use PreModuleCreate and define the password and username using global

 

global $params['username'], $params['password'];
$params['username'] = 'foo';
$params['password'] = 'bar';

 

haven't tested it but this should work.

Link to comment
Share on other sites

global $params['username'], $params['password'];
$params['username'] = 'foo';
$params['password'] = 'bar';

 

Thanks for the reply!

 

Unfortunately, it didn't work out (or I missed something on the way). I've used PreModuleCreate hook and updated the database from there to substitute username/password fields I had.

Link to comment
Share on other sites

Worse come to worse you can use a hash map, but the programming gods will probably curse you for this most egrarious of sins.

 

It's better not to be using pregenerated logins per se but to be procedurally generating them in some way you find appealing. For example a common method is to use the last name and first letter of the first name of the account holder (appending an incremental index # if neccesary) and then using a salted, random password.

Link to comment
Share on other sites

For example a common method is to use the last name and first letter of the first name of the account holder (appending an incremental index # if neccesary) and then using a salted, random password.

 

Peter, that's what we have in our system, the passwords/usernames are generated using similar approach, and upon premodule creation these credentials are used.

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