Hi Guys,
I have come across a scenario where i have to validate the user name and password for logging in to a particular screen.
The password is auto generated and send to the person who is logging in. The password is a alphanumeric string which has both lower case and upper case alphabets.
When i try and validate using the StartsWith function the user is able to login even if he/she enters the password irrespective of the case. I want the password to be case sensitive and only grant the user access if the entered password matches the given password as it is.
The generated password is stored in a SharePoint list.
How can i achieve this. Kindly advise on how to move ahead.
Thanks & Regards
Srinath
Solved! Go to Solution.
Hi @Srinath :
Sorry, after I tested again, I found that the second parameter of IsMatch function doesn't seem to support the reference value.(This is just an Idea under review)
Please try this code:
If(!IsBlank(LookUp('New Applicant Credentials', UserName exactin TextInput2.Text&&Password exactin TextInput2_1.Text)),Navigate(Screen3,ScreenTransition.Fade),Set(errormsg,true));
Reset(TextInput2);Reset(TextInput2_1);
Best Regards,
Bof
Can you display the Formula
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Hi @eka24 ,
Set(varUser, LookUp('New Applicant Credentials', StartsWith(UserName ,TextInput2.Text) && StartsWith(Password,TextInput2_1.Text)));
If(!IsBlank(varUser),Navigate(Screen3,ScreenTransition.Fade),Set(errormsg,true));
Reset(TextInput2);Reset(TextInput2_1);
This is my formula. 'New Applicant Credentials' is a SharePoint list. UserName and Password are 2 fields with in the list.
Regards
Srinath
Hi @Srinath :
What is the resason you use "StartsWith"?
Do you consider using "=" instead of "StartsWith"?
The reason I don't recommend using "StartsWith" is:
1\Case sensitivity:For both EndsWith and StartsWith , the tests are case insensitive. Description
2\Security issues:Even if the user does not enter the complete account and password, they can still pass the verification.
I suggest you try this code:
Set(varUser, LookUp('New Applicant Credentials', UserName=TextInput2.Text&& Password=TextInput2_1.Text));
If(!IsBlank(varUser),Navigate(Screen3,ScreenTransition.Fade),Set(errormsg,true));
Reset(TextInput2);Reset(TextInput2_1);
Best Regards,
Bof
Hi @v-bofeng-msft ,
I have tried with '='. Even then it is not case sensitive. It lets users in if they enter 'z' instead of 'Z'.
Regards
Srinath
Hi @Srinath :
I made a test but did not encounter the problem you mentioned.
I suggest you clear the value of variable 'varUser' before testing.
If the problem cannot be solved, I suggest you use the following code:
If(!IsBlank(LookUp('New Applicant Credentials', UserName=TextInput2.Text&& Password=TextInput2_1.Text)),Navigate(Screen3,ScreenTransition.Fade),Set(errormsg,true));
Reset(TextInput2);Reset(TextInput2_1);
Or
If(!IsBlank( LookUp('New Applicant Credentials', IsMatch(UserName ,TextInput2.Text) && IsMatch(Password,TextInput2_1.Text))),Navigate(Screen3,ScreenTransition.Fade),Set(errormsg,true));
Reset(TextInput2);Reset(TextInput2_1);
Best Regards,
Bof
Hi @v-bofeng-msft ,
I have tried using the second code that you had provided, it gives me an error saying IsMatch has some invalid arguments.
Please find attached a screenshot of the same.
Kindly advice.
Regards
Srinath
Hi @Srinath :
Sorry, after I tested again, I found that the second parameter of IsMatch function doesn't seem to support the reference value.(This is just an Idea under review)
Please try this code:
If(!IsBlank(LookUp('New Applicant Credentials', UserName exactin TextInput2.Text&&Password exactin TextInput2_1.Text)),Navigate(Screen3,ScreenTransition.Fade),Set(errormsg,true));
Reset(TextInput2);Reset(TextInput2_1);
Best Regards,
Bof
Hi @v-bofeng-msft ,
I have tried 'Exact in' and it works.
Thanks for looking into my issue. Really appreciate it.
Regards
Srinath
Hi @Srinath :
Is your app working now?
If your issue has been resolved, please mark it as a "solution" where your request is resolved so that other users can find it.
Extremely grateful.
Best Regards,
Bof
User | Count |
---|---|
183 | |
110 | |
88 | |
44 | |
42 |
User | Count |
---|---|
227 | |
108 | |
106 | |
68 | |
68 |