Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

CB Auto action to move a file

  • GUEST
8 years 2 months ago #284447 by
Replied by on topic CB Auto action to move a file
Anyone have any ideas why this cb auto action is breaking the password encryption from working when a new user registers ?

Password gets stored in readable plain text format

Krileon - seen this before or any hunches please?

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

  • GUEST
8 years 2 months ago #284458 by
Replied by on topic CB Auto action to move a file
OK got it king by doing the following

Trigger = onAfterUserRegistration

Position = FIRST (in auto actions ordering)

Params: Reload User = Yes / Format Sunctions = yes

Conditions: [var1_cb_resume] is not empty (make sure something was uploaded!)

Code: Notice I'm using var_ before all field names EXCEPT userid which I assume is only just being assigned at this point so can;t use new value?

Anyway this is now working for me and user passwords are again being stored encrypted! :)
Code:
jimport('joomla.filesystem.folder'); $basePath = JPATH_SITE . '/images/comprofiler/plug_cbfilefield/[user_id]'; $oldPath = $basePath . '/[var1_cb_resume]'; $fileExt = JFile::getExt('[var1_cb_resume]'); $newFilename = '[cb:parse function="clean" method="string"][var1_firstname][/cb:parse]_[cb:parse function="clean" method="string"][var1_lastname][/cb:parse]_[user_id].'.$fileExt; if ( file_exists( $oldPath ) ) { @rename( $oldPath, $basePath . '/' . $newFilename ); $user->set( 'cb_resume', $newFilename ); $user->store(); }

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 2 months ago #284459 by krileon
Replied by krileon on topic CB Auto action to move a file
Just null the password before storing. Example as follows.

$user->set( 'password', null );

The password store will then be ignored for your user store call. For an action like this though yes I recommend using Reload User. This is only an issue for actions directly after registration where the plaintext password still exists during the registration operation and a reload user or null of password should prevent such issues.


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.
The following user(s) said Thank You:

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

  • GUEST
8 years 2 months ago #284460 by
Replied by on topic CB Auto action to move a file
Thank you for explaining that

I set it to reload user and that seems to fix it for me :)

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

  • GUEST
8 years 2 months ago #284463 by
Replied by on topic CB Auto action to move a file
Actually I found that this was also an issue when editing your profile in admin area ONLY If you added new passwords at same time as uploading a new file as like you say the passwords are being submitted in plain text format at that point.

Setting reload user to yes on these triggers also helped to fix this....

Wow its taking me over 1.5 days to just code this simple filename rename process :)

phew! done....

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 2 months ago #284465 by krileon
Replied by krileon on topic CB Auto action to move a file
Yes, it'll affect store behaviors where the password has changed since the plaintext password is still in the user object. Without a Reload User or null of the password it'll store that plaintext password. It's kept in object for things like emails or synchronization plugin; so it has a use, but for you it becomes an issue. The Field action and several other actions protect against these issues, but the Code action doesn't null it for you as there could be a use for it.


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