Hi Members,
I had a requirement in Power Apps to create a Power Apps login screen.
I have a SharePoint list [ACGH Login] with three columns:
- UserName [Title]
- Email
- Password

Now. In my Power Apps, I have created a Login screen where users can log in using the fields Email/Username and password.
But, I was facing some small issues in my code like:
1 = Whenever the user provides the email/username and password and clicks on the login button, it does not even navigate to the next screen.
2 = Whenever the user provides the right username/email and wrong password and clicks on a button, it does not display an error like "Provide a valid password."
If(
IsBlank(txt_Email.Text) && IsBlank(txt_Password.Text),
Set(
var_EmailErrorMsg,
"Enter an Email Address or User Name"
);
Set(
var_PasswordErrorMsg,
"Enter a Password"
),
If(
IsBlank(txt_Email.Text),
Set(
var_EmailErrorMsg,
"Enter an Email Address or User Name"
),
Set(
var_EmailErrorMsg,
""
)
);
If(
IsBlank(txt_Password.Text),
Set(
var_PasswordErrorMsg,
"Enter a Password"
),
Set(
var_PasswordErrorMsg,
""
)
),
If(
And(
Not(IsBlank(txt_Email.Text)),
Not(
Or(
IsMatch(txt_Email.Text, "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$"),
EndsWith(txt_Email.Text, "@gmail.com")
)
)
),
If(
Not(IsEmpty(Filter('ACGH Login Details', Title = txt_Email.Text))),
Set(var_EmailErrorMsg, ""),
If(
IsBlank(txt_Email.Text),
Set(var_EmailErrorMsg, ""),
Set(var_EmailErrorMsg, "Enter a valid User Name")
)
),
If(
Not(IsEmpty(Filter('ACGH Login Details', Email = txt_Email.Text))),
Set(var_EmailErrorMsg, ""),
If(
IsBlank(txt_Email.Text),
Set(var_EmailErrorMsg, ""),
Set(var_EmailErrorMsg, "Enter a valid Email")
)
)
),
If(
IsEmpty(
Filter(
'ACGH Login Details',
(Email = txt_Email.Text || Title = txt_Email.Text) && Password = txt_Password.Text
)
),
If(
Not(IsEmpty(Filter('ACGH Login Details', Or(Email = txt_Email.Text, Title = txt_Email.Text)))), // Check if email or username exists
Set(
var_PasswordErrorMsg,
"Enter a valid password"
),
Set(
var_PasswordErrorMsg,
""
)
),
Navigate(HomeScreen)
)
)
It is working fine up to the UserName/Email validation field. But only for the password validation is it facing an error. like the below code image:

Please, anyone, help me with the below scenarios:
1 = Whenever the user provides the email/username and password and clicks on the login button, it should navigate to the next screen.
2 = Whenever the user provides the right username/email and wrong password and clicks on a button, it should display an error like "Provide a valid password."
Can anyone please suggest how I can achieve this? Thanks in advance!