Password encryption.
Question

Have created a small login flow but it stores plain text password .I want to encrypt all passwords one by one using for each loop to iterate all the records and update the password for the respective user. How to do it?

mvp_badge
MVP

Hi Shrushti,

To encrypt the password, you will have to use the EncryptPassword() function from the Users module.

So, in your case, within the forEach loop, before updating the user record, you will have to encrypt the raw password using EncryptPassword() and pass the encrypted value for the update.


I hope this helps you!


Kind regards,

Benjith Sam

I know this procedure and have been using it too. The issue is I am unable to update the user in the entity with the newly encrypted password. It is not updating the password column for that particular user. So wanted to know do I need to create aggregate by Id or something before iterating the list? And then encrypt the password and update the user by Id with  newly created password?

Thanks

Shrushti

Hi Komal and Ban 

What I have understood from Shrushti post is - 

She is asking for updating the password with encryption for the already created users in DB with the Plain Text. She might know how to encrypt but question is to update the existing user data with the encryption method. 


@Shrushti, if I am correct you will need to fetch the users data first. Since User is a system table, it is prefixed with ossys_ (so ossys_user).


Then you are process the ForEach loop with updating the password with the reliable function and assign it. 


Please feel free to ask in you have further doubts.

Hi Manish ,

You got it right. Will definitely try what you suggested.

Thanks

Shrushti


Hii Shrushti 

You're Welcome:) Have you tried this and achieved the requirement?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.