cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

How to compare case sensitive passwords in Power Apps

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

1 ACCEPTED SOLUTION

Accepted Solutions

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);

 

Capture.JPGCapture2.JPG

Best Regards,

Bof

 

View solution in original post

10 REPLIES 10
Super User III
Super User III

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);

 

Capture.JPGCapture2.JPG

Best Regards,

Bof

 

View solution in original post

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

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (93,939)