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

[Custom Login Screen] Log In with a User Level Access

Hi All,

 

I need help.

 

I want to create a custom login form with several conditions.

Here is the scenario:
When users log in to the app, PowerApps only show the screen based on their position.
for example:
Mr. ABC as a Staff, Mrs. DEF as a Supervisor, then when Mr. ABC log in he just gets a Staff screen and when Mrs. DEF logs in, she can access to Staff and Supervisor screen.

I already create a table on Data Source with Name, Email, Password and Position column.
On Canvas App, I set TextInput1 (Email), TextInput2 (Password) and button1 (Login).
On button1, I set a function on OnSelect event If(LookUp('MyDataSource', Email = TextInput1.Text, Password)=TextInput2.Text, Nagivate(StaffScreen,None)). This action is just only take users to Staff Screen.

How to solve this problem?

Thank You

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: [Custom Login Screen] Log In with a User Level Access

Just because the customer requests it based on not understanding how the application works doesn't mean you should fulfill the request.  It would be better to explain to the customer why its not necessary. 

 

But here is the answer to your questions.  Set a variable at AppStart equal to user().Email and use that in your If() function for #1.  For #2 you need to do a Lookup to get the particular record you want from the list to read the position.  I'm not sure what your list looks like so I can't tell you specifically what #2 should look like.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
Highlighted
Dual Super User
Dual Super User

Re: [Custom Login Screen] Log In with a User Level Access

Since users login to use Power Apps you don't need to create a login screen.  Just create a list that records the level you want to give each user and get their name or email address when the app starts using User().  Then check them against the list to give them what you want them to have.  Just remember Power Apps isn't a security layer.  you can control what they see, but if they bypass Power Apps and go directly to the back end data source they will have whatever permission they are given to the data source.  Power Apps won't have any effect then.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Frequent Visitor

Re: [Custom Login Screen] Log In with a User Level Access

Hi @Pstork1,

 

Thank you for your feedback.


Actually this Custom Login Screen is based on customer request.

I tried based on your reference, this formula is like this:

1) If(User().Email="my@mail.com",Navigate(StaffScreen,None),false)
    but this isn't getting dynamic data from Data Source.

2) If('List'.Position="Staff",Navigate(StaffScreen,None),false)

    It's getting an error on "="

Any alternative solution?

Thank You

Highlighted
Dual Super User
Dual Super User

Re: [Custom Login Screen] Log In with a User Level Access

Just because the customer requests it based on not understanding how the application works doesn't mean you should fulfill the request.  It would be better to explain to the customer why its not necessary. 

 

But here is the answer to your questions.  Set a variable at AppStart equal to user().Email and use that in your If() function for #1.  For #2 you need to do a Lookup to get the particular record you want from the list to read the position.  I'm not sure what your list looks like so I can't tell you specifically what #2 should look like.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted
Frequent Visitor

Re: [Custom Login Screen] Log In with a User Level Access

Hi @Pstork1 ,

 

Thank you for your feedback.

This was solved using your method.

 

First, on App, I set a variable on the OnStart event that contains User().Email.

Then I set a formula using If and LookUp function against Data Source.

The formula is like this:

If(LookUp(my_list,Email=varUser,Position)="Staff",Navigate(StaffScreen,Fade),false))

 

Thank You

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,790)