web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Password screen that n...
Power Apps
Answered

Password screen that navigates a user to a particular page dependant on user name.

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, 

I have an app that needs a password screen, that when successfully logged in the user will be directed to a particular screen;

ie User A will be directed to screen 1, User B, to screen 2 and User C to screen 3.

 

The login screen currently has two input boxes one for user name and one for password and I've managed to get that to work with the user names and passwords stored in a sharepoint list (it's only  a small list).

Currently a successful login navigates me to a generic page. How do I navigate dependant on user name? 

 

To add an extra twist ...is it possible to replace the user name input box with a dropdown (just trying to make it a bit more idiot proof).

 

Current code is below where 'User Credentials' is the name of the list, Title is the name of the users Password etc. 

 

Thanks in advance.

----------------------

If(

  !IsBlank
  (LookUp ('User Credentials',Title=TextInput1.Text And Password=TextPassword.Text).Title),
       Navigate(StartScreen,ScreenTransition.None),
Notify(
"Invalid Password! Please enter a valid password",
NotificationType.Error
)
);
Reset(TextPassword);
Reset(TextInput1);

Categories:
I have the same question (0)
  • mmollet Profile Picture
    3,187 on at

    You can use a dropdown to show the usernames that are stored in the SP list you mentioned.
    Set items property of dropdown to your list name and set the DisplayFields property to the column you want to display in the dropdown. (UserName in your case)

     

    If you have few users total like you mentioned you could use a switch statment or if statments to decide where to go based on the user's email/username etc. 

    Switch(condition1, navigateA, condition2, navigateB, condition3 or condition4 or condition5, navigateC)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @mmollet 

    Thanks for the response, I've got the dropdown to work.

    I'm just stuck on using the switch command in combination with the password?

    I.e I can get it to work with dropdown only and no password.

    Would you put the place the switch command in the lookup section?

     

  • Verified answer
    mmollet Profile Picture
    3,187 on at

    If(passwordIsCorrect, Switch(User().Email, "john@email.com", Navigate(adminPage), "ross@email.com", Navigate(accountingPage), "emily@email.com", Navigate(otherPage)))

     

    The real thing is knowing what to put where. If you are using the user's Email or FullName as given by the User().Email or User().FullName functions then you wouldnt really even need a dropdown for username as the system already knows the email and full name of the user currently logged in to the app via the User() object. If the username is different than these 2 values then the dropdown would be needed and would also be used in the if statment to look up the correct password.

     

    Example: Mike has and email of mike@email.com and a full name of "Mike Jones" but has a username of mjones to log into the app. Assuming that mjones was selected in the dropdown menu:

    Login button display mode:

    If(Lookup(YourList, Username = dropdown.selected.value).password = textinput.text, displaymode.edit, displaymode.disabled)

     

    At this point you know that if the user selects their username and inputs the correct password, then they should have access to the button and be able to click "log in" button to advance. Now you want to tackle the navigation part of the solution.

     

    Log-In button on select: 

    Switch(dropdown.selected.value, "jdoe", Navigate(johnScreen), "mjones", Navigate(mikeScreen), "emusk", Navigate(elonPage))

     

    This will now take the username from the dropdown and use it as the string that the switch cases will evaluate on. In this case it would fail the first one as "jdoe" != "mjones" and would move on to the second case where "mjones" = "mjones" and would then execute the navigate functions and take him directly to mikePage in the app.

     

    hope this helps!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks @mmollet 

    That was really helpful!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard