Jump to content

Hook for password generation


m107

Recommended Posts

In my website order form, I adjusted the code to generate a random hostname and password instead of asking the client. 

<input type="hidden" name="hostname" class="form-control" id="inputHostname" value="{php}$rdmpww = substr(str_shuffle("abcdefghkmnpqrstwxyzABCDEFGHKMNPQRSTUVWXYZ"), 0, 5); echo $rdmpww;{/php}" >
<input type="hidden" name="rootpw" class="form-control" id="inputRootpw" value="{php}$rdmpw = substr(str_shuffle("@#$*123456789abcdefghkmnpqrstwxyzABCDEFGHKMNPQRSTUVWXYZ"), 0, 16); echo $rdmpw;{/php}">

Now in the latest WHMCS, it is recommended to disable the php smarty tag, so I cant use the above lines in my template anymore. The only work around should hook, I suppose. any idea how this can be converted to a hook?

 

thanks

Link to comment
Share on other sites

3 minutes ago, m107 said:

No no, you can see I was using  "{php}", now I cant use it.

It was DEPRECATED years ago, not disabled.
And it was deprecated both by WHMCS and Smarty.
 

Up to WHMCS 8.7 it should works (if you enable it: https://docs.whmcs.com/Security_Tab#Allow_Smarty_PHP_Tags ), and it will be totally removed with WHMCS 9 ( https://docs.whmcs.com/Eliminating_Legacy_Smarty_Tags )

Link to comment
Share on other sites

8 minutes ago, Remitur said:

It was DEPRECATED years ago, not disabled.
And it was deprecated both by WHMCS and Smarty.
 

Up to WHMCS 8.7 it should works (if you enable it: https://docs.whmcs.com/Security_Tab#Allow_Smarty_PHP_Tags ), and it will be totally removed with WHMCS 9 ( https://docs.whmcs.com/Eliminating_Legacy_Smarty_Tags )

Exactly. WHMCS support gave me this page:

https://docs.whmcs.com/Smarty_Security_Policy#Allow_Smarty_PHP_Tags

 

But I could not understand it.

Link to comment
Share on other sites

6 minutes ago, Remitur said:

In General Settings -> Security you should have something like this (but, as you can see,  the recommended option is to DISABLE it):

 

screenshot-domainregister.international-2023.04.28-11_00_36.png

@Remitur I know and I want to disable it, but my question is what to do now?  How can I generate random password and hostname from now on?

Link to comment
Share on other sites

11 hours ago, m107 said:

@Remitur I know and I want to disable it, but my question is what to do now?  How can I generate random password and hostname from now on?

To generate a pseudo-random password 16 chars long, you can use this Smarty expression:

{"@#$*123456789abcdefghkmnpqrstwxyzABCDEFGHKMNPQRSTUVWXYZ"|str_shuffle|truncate:16:""}

 

Link to comment
Share on other sites

11 hours ago, Remitur said:

To generate a pseudo-random password 16 chars long, you can use this Smarty expression:

{"@#$*123456789abcdefghkmnpqrstwxyzABCDEFGHKMNPQRSTUVWXYZ"|str_shuffle|truncate:16:""}

Is this correct?

<input type="hidden" name="rootpw" class="form-control" id="inputRootpw" value={"@#$*123456789abcdefghkmnpqrstwxyzABCDEFGHKMNPQRSTUVWXYZ"|str_shuffle|truncate:16:""}
>

 

Link to comment
Share on other sites

On 4/29/2023 at 2:39 AM, m107 said:

Is this correct?

<input type="hidden" name="rootpw" class="form-control" id="inputRootpw" value={"@#$*123456789abcdefghkmnpqrstwxyzABCDEFGHKMNPQRSTUVWXYZ"|str_shuffle|truncate:16:""}
>

 

Don't forget to enclose your value in quotes (attribute="attributevalue")

Link to comment
Share on other sites

  • 3 weeks later...

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