Change password fields

Hi all

I’ve tried to find this in the docs and in this community but without luck.

I have a form where details can be updated. Part of this is two fields - password and password2. If they are left empty then I want the password to be unchanged. But, if anything is entered into the password field, then the same must be entered in password2 and then it’s encrypted (SHA1) and updated in the database.

But, how do I set it to only update when something is entered?

And how do I check the values of password and password2 are the same?

Thanks again in anticipation.

Not sure if this doc might help a little for the one part.

As far as only updating the record if the user has actually input something it is that should be quite simple by by adding a condition to the right of the value.
Lets say you have your database update step and you want to only update the password if the user has entered something, then the column would be set to say password, the type will be text, the value would be your post vaiable from your form holding the password and the condition would be the same as the value, which means if user has input something then use the value.

Hope that makes sense. Here is a small sample, i use update conditions a lot.

2 Likes

Thanks @psweb, that’s exactly what I needed and it’s now working like a charm. I’ve also added the dynamic attribute to check both password inputs are the same and disabled the submit button if they’re not.

Thanks again for your help. I’m not sure why I didn’t find the post you quoted but that proved very helpful.

3 Likes