Skip to Content Skip to Menu

[SOLVED] Alter the generated password

6 years 2 weeks ago #308375 by MarlonFungai
Replied by MarlonFungai on topic Alter the generated password
Ok I tried setting up the AutoAction as instructed and it has absolutely no effect on the password. I used $variables["var1"]->setRandomPassword(6); as the code and I have checked the autoaction a few times and I still get the a 12 character password. I found the original function setRandomPassword and hacking does have the desired effect so I can't understand why overriding doesn't. I have also put the auto action in debug mode and checked and double checked whether everything was published and set as reference. Nothing shows up. Could I be using the wrong trigger?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
6 years 2 weeks ago #308381 by krileon
Replied by krileon on topic Alter the generated password
Be sure Reference Variables is configured or it won't be able to modify the user object by reference. This won't do anything for backend through as it's strictly for frontend so be sure you're testing on frontend only. If you want it to also apply to backend you need to add the onBeforeNewUser trigger as well.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

6 years 2 weeks ago #308384 by MarlonFungai
Replied by MarlonFungai on topic Alter the generated password
I have configured variable 1 as reference in the parameters tab of the auto action. In the action tab I have this code:

$variables->setRandomPassword(6);
$hashedPassword = $variables->hashAndSaltPassword($variables->password );
$variables->password = $hashedPassword;
$variables->store();

with PHP selected

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
6 years 2 weeks ago - 6 years 2 weeks ago #308389 by krileon
Replied by krileon on topic Alter the generated password
That's not the code that was provided. See my reply below.

www.joomlapolis.com/forum/255-developer-members-support/239506-alter-the-generated-password?limitstart=0#306684

That trigger does not require hashing since the hashing happens after that trigger. Store also is not necessary as it will interrupt the registration process and store will happen after the trigger. You should only need to use the below for the code.

Code:
$variables['var1']->setRandomPassword( 6 );

$variables is just an array of variables sent by the trigger. var1 is the user object being registered for that trigger.

When testing enable debug mode and maximum error reporting in Joomla global configuration then also enable Debug within your auto action under Parameters. This should ensure if an error does happen it'll be displayed. If your server does not allow create_function or eval you won't be able to pass variables by reference.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 6 years 2 weeks ago by krileon.

Please Log in or Create an account to join the conversation.

6 years 2 weeks ago - 6 years 2 weeks ago #308391 by MarlonFungai
Replied by MarlonFungai on topic Alter the generated password
Hi krileon

I actually started with that code that you provided in the previous answer and it has no effect on the password neither does any of the code I have tried. I checked if I forgot to publish the auto action and if the access level was everybody and everything seems to be correct but nothing. I have just tested again with the only the code:

Code:
$variables['var1']->setRandomPassword( 6 );

and there is no change here is the email with the password;

[REMOVED]
Last edit: 6 years 2 weeks ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
6 years 2 weeks ago #308393 by krileon
Replied by krileon on topic Alter the generated password
Please do not most login credentials here as they are publicly visible forums. Are you testing this on frontend or backend? What you're wanting to do may just simply not be doable without modifying the core code. The password gets regenerated at time of confirmation if confirmation is enabled for example where this code won't impact so it'd be generated with 12 characters again.

With that said I still do not recommend halfing the security of passwords. The recommend secure length for a password is 12 characters (or more). As it's randomly generated it's gibberish regardless of how long it is.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum