identity: fix no error being showed if user is locked out
This commit is contained in:
@@ -87,18 +87,20 @@ namespace Streetwriters.Identity.Validation
|
||||
if (user == null) return;
|
||||
|
||||
var result = await SignInManager.CheckPasswordSignInAsync(user, password, true);
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
await EmailSender.SendFailedLoginAlertAsync(user.Email, httpContext.GetClientInfo(), client).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
else if (result.IsLockedOut)
|
||||
|
||||
if (result.IsLockedOut)
|
||||
{
|
||||
var timeLeft = user.LockoutEnd - DateTimeOffset.Now;
|
||||
context.Result = new LockedOutValidationResult(timeLeft);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!result.Succeeded)
|
||||
{
|
||||
await EmailSender.SendFailedLoginAlertAsync(user.Email, httpContext.GetClientInfo(), client).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
var sub = await UserManager.GetUserIdAsync(user);
|
||||
context.Result = new GrantValidationResult(sub, AuthenticationMethods.Password);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user