cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SunshineK
Helper II
Helper II

Create a login in screen with password ONLY

Hi Team - as subject states: I want to create a login in screen with a password ONLY to access the other screens.

If the password is incorrect I want to have a text popup that says 'Try Again' or 'Contact Us'.

However I am a little bit lost and need some input please. 

 

SunshineK_0-1622690640910.png

 

My Onselect for my login button: 

 

If('password'.text = "1234",

Reset('password');

UpdateContext({PopUp:false]);

Navigate(ScreenHome)

 

If('password'.text = "summeriscool",

Reset('password');

UpdateContext({PopUp:false]);

Navigate(ScreenHome)

UpdateContext

({

    Message Text: Incorrect. Try again.",

    BadPasswordCount: Sum(Value(BadPasswordCount),1),

    {);

    Reset(password input)

);

 

If(BadPasswordCount = 3)

UpdateContext({PopUp:true})

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @SunshineK,

Could you please tell me that if the data type of the password in the Table1 in Text type?

Also, tell me that "&" operation means what, do you want to combine the strings with "&"? I want to explain to you that the "&" is an operator used to combine with two strings, but the formula in your scenario turns that there are two different conditions rather than two strings, so please replace the "&" with "&&" which means the "And".

Hope it could help.

Regards,

Qi

Best Regards,
Qi

View solution in original post

6 REPLIES 6
v-qiaqi-msft
Community Support
Community Support

Hi @SunshineK,

Could you please share a bit more about the scenario, where do you set the variable MessageText and BadPasswordCount?

Please share more details about your configuration

From now on, I could help you modify a little bit as below:

If(
    'password'.Text = "1234",
    Reset('password');
    UpdateContext({PopUp: false});
    Navigate(ScreenHome),
    If(
        'password'.Text = "summeriscool",
        Reset('password');
        UpdateContext({PopUp: false});
        Navigate(ScreenHome),
        UpdateContext(
            {
                MessageText: " Incorrect. Try again.",
                BadPasswordCount: Sum(Value(BadPasswordCount.Text),1)
            }
        );
        Reset(BadPasswordCount),
        If(
            Value(BadPasswordCount.Text) = 3,
            UpdateContext({PopUp: true})
        )
    )
)

Check if this could help you.

Regards,

Qi

Best Regards,
Qi

Whoops - I probably shouldn't have two passwords. 

 

So basically how I want it to work is when you open the app it asks the user to fill in a password, and then have a login button. 

 

If the password is correct - it will take you to the home screen. 

If the password is incorrect - it has a pop up on the login screen that says 'Incorrect Password' for 5 seconds.

If the password has been entered incorrect 3 times - it has a pop up on the login screen that says 'contact us' or 'try again'. 

SunshineK
Helper II
Helper II

Hi Team - I have tried a different way ... only one error this time which is good.

 

SunshineK_0-1623366712488.png

SunshineK_1-1623366729493.png

 

password input format is 'Text'. 

 

When I click the login button it does nothing. 

 

Any suggestions?

 

Hi @SunshineK,

Could you please tell me that if the data type of the password in the Table1 in Text type?

Also, tell me that "&" operation means what, do you want to combine the strings with "&"? I want to explain to you that the "&" is an operator used to combine with two strings, but the formula in your scenario turns that there are two different conditions rather than two strings, so please replace the "&" with "&&" which means the "And".

Hope it could help.

Regards,

Qi

Best Regards,
Qi

thank you so much. This worked!! 

if I was to have the password as numbers - how would I make that work?

Hi @SunshineK,

If you have used the correct operator but have type of number, you should format the Username.Text as Value(Username.Text).

Only need to format the text string using the Value() function.

Regards,

Qi

Best Regards,
Qi

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,092)