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

I got stuck here for half a day

I have created a sharepoint list with email id and password.

Now in power apps in login screen I'm unable to check the email and password entered is correct with this if statement.

Check this attachment:

Rhk_0-1626777469102.png

If((TextInput1.Text = Account_Registration.Email_SP) && (TextInput1_1.Text = Account_Registration.Password_SP), Navigate(Login_Screen_to_,None))

2 ACCEPTED SOLUTIONS

Accepted Solutions
timl
Super User
Super User

Hi @Rhk 

The formula you can use would look like this:

 

 

If(CountRows(Filter(Account_Registration, 
                    Email_SP=TextInput1.Text && Password_SP=TextInput1_1.Text))=1,
   Navigate(Login_Screen_to_, None),
   false
)

 

 

You can find more details in my post here, in particular, the negative security aspects of saving plain text passwords in a SharePoint list.

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-create-a-login-page/m-p/527316

View solution in original post

JR-BejeweledOne
Super User
Super User

Try changing your formula like this:

If(
    Account_Registration.Email_SP = TextInput1.Text && 
     Account_Registration.Password_SP = TextInput1_1.Text, 
     Navigate(Login_Screen_to_,None)
  )

 

If it still doesn't like the '=' try this:

 

If(
    TextInput1.Text exactin Account_Registration.Email_SP && 
    TextInput1_1.Text exactin Account_Registration.Password_SP, 
     Navigate(Login_Screen_to_,None)
  )

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

3 REPLIES 3
timl
Super User
Super User

Hi @Rhk 

The formula you can use would look like this:

 

 

If(CountRows(Filter(Account_Registration, 
                    Email_SP=TextInput1.Text && Password_SP=TextInput1_1.Text))=1,
   Navigate(Login_Screen_to_, None),
   false
)

 

 

You can find more details in my post here, in particular, the negative security aspects of saving plain text passwords in a SharePoint list.

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-create-a-login-page/m-p/527316

JR-BejeweledOne
Super User
Super User

Try changing your formula like this:

If(
    Account_Registration.Email_SP = TextInput1.Text && 
     Account_Registration.Password_SP = TextInput1_1.Text, 
     Navigate(Login_Screen_to_,None)
  )

 

If it still doesn't like the '=' try this:

 

If(
    TextInput1.Text exactin Account_Registration.Email_SP && 
    TextInput1_1.Text exactin Account_Registration.Password_SP, 
     Navigate(Login_Screen_to_,None)
  )

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
KvB1
Solution Sage
Solution Sage

Both of the above will work, but it won't check the password against the entered mail, simply if the password exists at all. 

You could create a function that checks if the entered email is in the SharePoint list, and if yes check the entered password with the password connected to that mail in the SharePoint list. This denies access in the off chance someone entered a wrong password, but that wrong password is used by someone else as their actual password.

 

Since you are storing passwords in SharePoint (I would advise against storing passwords anywhere anyway, they should be personal), you should set the permissions in the list so that users can only see their own entries, to prevent people navigating to the list with the URL and getting access to everyones passwords, or block navigation to the site entirely.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,615)