-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft Identity is not blocking users not yet confirmed #60586
Comments
First: Your thought about a not confirmed account you can brute force the password is false. Here a solution when you want to use the lockout with a not yet confirmed account. In this method the All the methods in the SignInManager are virtual. for example
dont forget to register your signinmanager to the service collection.
please be aware when using TwoFactor or ExternalLogin you should rewrite these implementation as well because the change we made in |
Is there an existing issue for this?
Describe the bug
I am using
RequireConfirmedAccount
andRequireConfirmedEmail
for myIdentityUser
and I am also usingLockout.AllowedForNewUsers
in myIdentityOptions
.In my
Login.cshtml.cs
I have enabledlockoutOnFailure: true
, and everything works fine for confirmed users (those who have received the confirmation email and finished the process).I discovered that an unconfirmed user is not affected by the lockout, that is, he can make infinite attempts without consequences.
In the default workflow you will always receive an "Invalid login attempt".
My concern is what happens when we consider the particular case of the user who wants to login but has not yet confirmed his email. Generally we show the user relevant information such as “Account not yet confirmed, do you want to send the confirmation email again?”. In this case using brute force we could try to find a user's password. For example, I am introducing an enhancement to the use case as follows:
I have even tried to detect an incorrect login for a user not yet confirmed and increase the failed count with
userManager.AccessFailedAsync(user)
, but still the user is not locked.Expected Behavior
When
options.SignIn.RequireConfirmedAccount = true; options.SignIn.RequireConfirmedEmail = true;
inIdentityUser
andoptions.Lockout.AllowedForNewUsers = true;
inIdentityOptions
, lock out the user even if it is not yet confirmed.Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
8
Anything else?
No response
The text was updated successfully, but these errors were encountered: