You are viewing limited content. For full access, please sign in.

Question

Question

Compare two fields for passwords

asked on August 12, 2020

Hi, 
I have a form with four fields User Name, Passcode, Password and Password Match. The user is selecting their user name from a dropdown list in the "User Name" filed. There is a lookup rule that then fills the "Passcode" field automatically with a password from the database (the Passcode filed is hidden). The user then enters their password into the "Password" filed and I want to return a value into the "Passcode Match " field of "Correct" or "Incorrect"

I have repurposed some code however I cannot get it to compare the data and return a result. What am i doing wrong? 

Thanks 

 

Snip 2.PNG
Snip 1.PNG
Snip 2.PNG (25.29 KB)
Snip 1.PNG (14.86 KB)
0 0

Replies

replied on August 13, 2020 Show version history

Since hidden fields are not truly secure, I would approach this slightly different.  Have just 3 fields (User Name, Password, and PW Match).  Let the user select their user name and fill in the password field.  Then have a lookup rule where user = User Name and pw = Password, fill PW Match with Password (or another DB field).

This way if password does not match, then the PW Match field remains blank.  If the PW Match field is not blank, then you know that the password is correct.

 

You could even create a Stored Procedure that takes the User Name and Password as inputs and returns Good/Bad, True/False, or Pass/Fail.

4 0
replied on August 13, 2020

This is the correct approach as opening up the web developer tools of the browser could see the password in plain text come through of every user that they select.

1 0
replied on August 13, 2020

Bert is 100% correct; you should not use this method.

 

That said, the JavaScript is likely not working because when it is executing, the password fields don't exist on the page yet, and so it doesn't add that function for when the field changes. Changing the first line to this should fix it:

$(document).on("change", ".repwd", function() {

 

0 0
replied on August 13, 2020

Thank you very much, tested and working

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.