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 Apps
Answered

Password Screen

(0) ShareShare
ReportReport
Posted on by 986

Hi everyone,
I have created a login screen for the users to access the application, reset password option to change the password but now I wanted to add a layer of security. On the login button of the login screen I am using the If block inside that using !IsBlank to check both the fields (username and password are not blank) and then checking if it is present in the SharePointList using Lookup. If it is True then I am navigating to Home Screen else navigating to Incorrect Details screen:
Login Button: (On-Select)

Sidhant_02_1-1677564341961.png

Variable created OnStart of App: (To Check wrong password attempts)

Sidhant_02_0-1677564270187.png


But now I want to also check for Wrong password attempts (along with checking if the details are present in the Sharepoint list)
So I did try something like this:

Sidhant_02_2-1677564461704.png

But here my concerns were
1. If user enters wrong password the first time then the count will be incremented by 1 and they will navigate to Incorrect Details screen which is:

Sidhant_02_3-1677564573317.png

 

but what I want is similar to the normal flow first the application should check if the details are correct: If yes go to Home screen else if user enters wrong username/password (or details which are not there in SharePointList then they should be navigated to the Incorrect Details screen). Another scenario was if the record is present in the SharePoint list but if the user enters wrong password three times then I want to show another page and lock that user out for 10 minutes.
So would like your inputs on how to achieve this.

Regards,
Sidhant. 

Categories:
I have the same question (0)
  • victorcp Profile Picture
    2,350 Moderator on at

    Hi,

    In this case I suggest you to add 2 new columns to your ShP:

    • Column to store how many times the user enter the wrong password (Attempts)
    • Column to verify if it is blocked or not (Blocked)

    How does it will work?

    Everytime the user enter a wrong password it will increase by 1 the Attempts columns when it reach 10 times it will set to true the column Blocked and trigger a flow which after 10 minutes will set the Attempts to 0 and blocked to false.

    if the user enter the correct password the Attempts will be reset.

    And create a condition to check if the user is blocked or not

     

    That's it I hope it helps 🙂

  • Sidhant_02 Profile Picture
    986 on at

    Hi,
    So you are saying I add Automate Flow to my canvas application to check the number of attempts and the value in the blocked column, I will try this out if it is possible could you recreate the scenario which you explained. Also won't it be possible to have a variable (which I have, which checks the number of times user enters incorrect password and updates the counter value).

    Regards,

    Sidhant.

  • victorcp Profile Picture
    2,350 Moderator on at

    I would do something like this:

    With(
     {account: LookUp('Login List',Title = TextInput1.Text)},
    
     If(
     account.Blocked,
    
     // account is blocked
     Notify("Account is blocked", NotificationType.Error,1200),
    
     // account is not blocked
     If(
     IsBlank(account) || account.Password <> TextInput2.Text,
    
     // wrong user or pass
     If(
     account.Attempts = 9,
     
     // block account
     Patch('Login List',account,{Blocked:true});
     Notify("Account has been blocked", NotificationType.Error,1200);
     Unblockaccount.Run(account.ID),
     
     // add one attempt
     Patch('Login List',account,{Attempts:account.Attempts+1});
     Notify("Username or password not found or incorrect", NotificationType.Error,1200)
     );
     
     Reset(TextInput1);
     Reset(TextInput2);
     Navigate('Incorrect Details'),
    
     // correct user and pass
     Navigate(Home);
     )
     )
    );

     

    And the flow (Unblockaccount) is just to unblock the account, and here it is:

    victorcp_0-1677582474809.png

    I hope it helps 🙂

  • Sidhant_02 Profile Picture
    986 on at

    Thanks @victorcp ,
    For the expression and flow, I will try this out and reply back if there is help required.

    Regards,
    Sidhant.

  • Sidhant_02 Profile Picture
    986 on at

    Hi victor,
    I used the expression which you had replied but for the second if statement it was displaying invalid arguments error. I have attached it with this reply. Another thing was for the flow that you have given, should I create from the canvas App itself and what should be the template for it?.
    Is the error because no flow is created and I have to create that first, because in flow there are some fields which are mandatory one (like password, email, title) as in the sharepointlist I have made it mandatory because when a new user registers I want them to fill all these fields. So I created the flow first like

    Sidhant_02_7-1677748656090.png

     

    Sidhant_02_6-1677748027634.png

     




    Regards,
    Sidhant

     

    Screenshot 2023-03-02 141535.png
    Screenshot 2023-03-02 141453.png
  • Sidhant_02 Profile Picture
    986 on at

    Sidhant_02_3-1677747092778.png

    I created a blank flow from the Canvas App but after giving the site address and name Title, password, email were mandatory fields so in that what should be passed to it?
    The 2 columns that you said to create in SharePoint list, one Attempts (this is a Number column)

    Sidhant_02_4-1677747717312.png

    And the 2nd column is a Blocked (which is a Yes/No) column:

    Sidhant_02_5-1677747773022.png

    Are these correct?. And as the two fields are mandatory I used the same dynamic expression for the remaining UpdateItem_Id:

    Sidhant_02_8-1677748782827.png

     

    In Sharepoint List:

    Sidhant_02_9-1677748830155.pngSidhant_02_10-1677748864560.png

    So the previous issue of Invalid arguments in If statement were gone now after creating the Unblockaccount flow in Canvas App. So I tried entering wrong password for one of the account:
    Username: Kimmy Pass: Kimmy@22 (correct details in list)
    I entered: Username: Kimmy Password: 1234 (any random thing) and on click it should me the correct screen which is Incorrect details but when I checked the SharePointList to see if the attempts value is incremented or not there was nothing displayed in Attempts (Number column it was blank)

    Sidhant_02_11-1677749386886.png

     

    What is missing? @victorcp 

    Regards,
    Sidhant.

  • Verified answer
    victorcp Profile Picture
    2,350 Moderator on at

    I suggest add a 'Get Item' action (not Get ItemS) to retrieve the mandatory info, like this:

    victorcp_0-1677749464999.png

    Any issue let me know

  • Sidhant_02 Profile Picture
    986 on at

    Tried using Get in the Flow to retrieve the ID and entered incorrect details but the count was not started in the SharePoint List

    Sidhant_02_0-1677751827669.pngSidhant_02_1-1677751848464.png

     

  • Verified answer
    victorcp Profile Picture
    2,350 Moderator on at

    The flow will trigger only if the number of attempts reach 9 (because it starts in 0) but you can change it whenever you want.

    victorcp_0-1677752881729.png

    If the user tries with an incorrect pass it will add 1 to attempts

     

  • Sidhant_02 Profile Picture
    986 on at

    Okay, so if user enters any incorrect details then the in the Attempts column there be should be an increment (start value is 0) so every time they enter incorrect details (user name or password) attempt value is incremented by 1 and when it reaches 10 they are not allowed to login again but before that (last attempt here 10th ) then they will be able to login and the flow will reset the attempts to 0 is it correct?.
    But right now what is happening that after entering incorrect details it is navigating to the desired screen (Incorrect details) but the attempts column is not affected that is there is no value been shown in the SharePoint List column?, as you did say that when user enters incorrect password +1 is added in the Attempts column @victorcp .

    Sidhant_02_0-1677834828931.png

    So in the expression is there is counter been implemented for Attempts column (on every wrong input value is increased by 1)?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard