fix: исправил ошибку, когда по email не удалось найти пользователя.

parent 81efc36c
......@@ -63,15 +63,17 @@ namespace PhoneStore.Services
public async Task<IdentityResult> LogIn(LoginViewModel model)
{
User user = await _userManager.FindByEmailAsync(model.Email);
SignInResult result = await _signInManager.PasswordSignInAsync(
user,
model.Password,
model.RememberMe,
false
);
if (result.Succeeded)
return new IdentityResult {StatusCodes = StatusCodes.Success};
if (user is not null)
{
SignInResult result = await _signInManager.PasswordSignInAsync(
user,
model.Password,
model.RememberMe,
false
);
if (result.Succeeded)
return new IdentityResult {StatusCodes = StatusCodes.Success};
}
return new IdentityResult
{
StatusCodes = StatusCodes.Error,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment