PDA

View Full Version : [Solved] WHMCS how to generate random password during VPS order



Fli
06-01-2016, 04:38 PM
In WHMCS (maybe only in older versions) client can set own password for the server/VPS product during order.

Client may enter special characters which may cause him being unable to access server or other issues.

Here is how to adjust order template to disable user setting own password and generating random password in background.

Edit:
/templates/orderforms/YOURORDERFORMTEMPLATENAME/configureproduct.tpl

Find something like:

<input type="password" name="rootpw" size="20" value="{$server.rootpw}" />

and replace it by:

<input type="hidden" name="rootpw" size="20" value="{php}$rdmpw = substr(md5(rand().rand()), 0, 10); echo $rdmpw;{/php}" />

Save and test ordering, password field should disappear and password be generated on background and then sent standard way to user once order is paid.