In our blog, we will be going to retrieve the user name and password from the SharePoint list. Using that credential we will log in and navigate to the welcome screen.
Steps to Create Login Screen
Step 1
Create a custom list having fields with a user name and user password as shown in the below image,
Step 2
Login to the power app’s window through “https://make.powerapps.com/”. Create a new Canvas app from a blank layout, either Tablet or Phone layout.
Step 3
We will add two screens. The first one is for Login and another is for Welcome screen,
Step 4
Login Screen is used for submitting a user name and password from a SharePoint list.
Add three labels (to display window title, user name, and password), two text inputs (to hold user name and password), and a button to login as showing below image,
Step 5
On the Welcome screen, just add a label that will display a success message if the user name and password are from the SharePoint list,
Step 6
Add SharePoint list as SharePoint data source. Add it through a View tab -> Data sources -> Search SharePoint -> Add a new or existing connection -> select your specific SharePoint Site -> Choose the specific list (User Credentials) -> Click on Connect button,
Step 7
Now click on “Login” button. On it’s select button add the below code.
- If (Count Rows (Filter ('User Credentials’, and (txtUserName.Text = User_x0020_Name,
- txtUserPassword.Text = User_x0020_Password)))=1,Navigate('Welcome Screen’, None),Notify("Invalid Login Details”, Error));Reset(txtUserName);Reset(txtUserPassword);
Step 8
Now save and test by pressing “F5”. Give user name and password from SharePoint list, it will navigate to the welcome screen.
If we add any other user name and password that is not present in the list it will notify an error on the login screen,