how to compare password field with Text field?

181deepak181deepak Member Posts: 95
edited 2014-05-27 in NAV Three Tier
Hi experts

I have a Password field (data type = text ) (The extended property of filed is Masked that's why I called is a password field), and one more Text field (Data type = text), (Both are customized fields),

but when I try to compare these fields
like
IF PasswordField = Rec.TextField THEN
BEGIN
//DO SOMETHING. LIKE PASSWORD MATCH
END
ELSE
BEGIN
// DO SOMETHING LIKE PASSWORD DON'T MATCH.
END;

BUT ALWAYS ELSE PART IS RUNNING EVEN TWO FIELDS HAVE SAME VALUE.

PLEASE SUGGEST SOLUTION//

Comments

  • kinekine Member Posts: 12,562
    Have you debugged the code? What you see as values in the two variables: PasswordField and Rec.TextField ? The problem is not in the compare part, but I think somewhere before it, in part where you are readin/filling these two values...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • 181deepak181deepak Member Posts: 95
    Thanks for reply,

    yes i did, i think the password field is encrypted and when i compare it with other text field it does't match,
    is there any way to decrypt is before match or any other suggestion.
  • kinekine Member Posts: 12,562
    you need to apply same decrypt function to your password and compare the result.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • 181deepak181deepak Member Posts: 95
    what is that function?
  • SiStSiSt Member Posts: 46
    If you only set the ExtendedDataType property the field is NOT encrypted. It is not shown in the user interface, but the value can still be read. So I do not see any problem with your code, it has to be the data. Text fields normally strip whitespaces at the begin and end of the value, so that could be a difference. Also try to re-type the password in the password field.
  • kinekine Member Posts: 12,562
    181deepak wrote:
    what is that function?

    If you are talking about the password in User Property table in NAV 2013, nobody knows... the password is set through SETUSERPASSWORD function which do that...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.