cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Wizkid_A
Frequent Visitor

Login Form based on Excel Table

Hey Guys!

 

I'm building a Power App with a login form.

 

I have a excel table with username and password. Now my function search if the entered username and password are in the table. See the example of the table below. If a user logins with username 1 and password 2 the loggin is succesfull because the table contains "2". What I want is that you only can login with username 1 and password 1. What do I need to change in my function?:
If(Username.Text in Tabel1.Username && Password.Text in Tabel1.Password; Navigate(Winkels;ScreenTransition.Cover);Notify("Verkeerd Wachtwoord!";NotificationType.Error))

 

UsernamePassword
11
22
1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Wizkid_A 

First, your formula would be this:

If(
    !IsBlank(
        LookUp(Table1; UserName=Username.Text && Password=Password.Text; Username)
    );
   Navigate(Winkels;ScreenTransition.Cover);

   Notify("Verkeerd Wachtwoord!";NotificationType.Error)
)

 

Next...be cautious as to what you are trying to do here.  You WILL need to share the Excel file with every user of your App.  So, they could simply open that file to see all the passwords you have in there.  Probably not what you want!

 

I would consider simply using the already existing Office 365 Login needed to run an app to get into the app. 

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
iAm_ManCat
Super User
Super User

Hi,

 

Although I wouldn't recommend having this kind of login screen, what you want to do is filter by that row that the username exists, then use that password.

 

You could use something like this:

 

If(
   Username.Text in Tabel1.Username
   && Password.Text = Filter(Tabel1, [@Tabel1].Username = Username.Text).Password; 
   
   Navigate(Winkels;ScreenTransition.Cover);
   Notify("Verkeerd Wachtwoord!";NotificationType.Error)
)

 

 I would recommend renaming your control called "Username" as well, to maybe something like txt_Username, so that you don't have to disambiguate between that and the Username column in the Excel,

 (I used [@Tabel1].Username to disambiguate between in the above example because they have the same name)

 

Kind Regards,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


RandyHayes
Super User
Super User

@Wizkid_A 

First, your formula would be this:

If(
    !IsBlank(
        LookUp(Table1; UserName=Username.Text && Password=Password.Text; Username)
    );
   Navigate(Winkels;ScreenTransition.Cover);

   Notify("Verkeerd Wachtwoord!";NotificationType.Error)
)

 

Next...be cautious as to what you are trying to do here.  You WILL need to share the Excel file with every user of your App.  So, they could simply open that file to see all the passwords you have in there.  Probably not what you want!

 

I would consider simply using the already existing Office 365 Login needed to run an app to get into the app. 

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@Wizkid_A 

I want to 2nd what @iAm_ManCat has said.  It is not necessary to build a login screen.  Users are already authenticated by Office 365 when they open the app.  Its like asking users to login twice.  A better method would be to check who logged in with the function User().Email and then show them different areas of the app based on their role.  Also, storing usernames and passwords in an Excel file is not secure... someone could find it and take all the usernames and passwords.

 

I'll leave @iAm_ManCat to answer the post but just wanted to state that best practice is not to use this method.

 

 ---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@RandyHayes 

Thanks for your reply. I used your function and it works. In this trial fase we use a excel file with store numbers. In the definitive phase we will use the logged in user profile.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,365)