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

parent 81efc36c
...@@ -63,6 +63,8 @@ namespace PhoneStore.Services ...@@ -63,6 +63,8 @@ namespace PhoneStore.Services
public async Task<IdentityResult> LogIn(LoginViewModel model) public async Task<IdentityResult> LogIn(LoginViewModel model)
{ {
User user = await _userManager.FindByEmailAsync(model.Email); User user = await _userManager.FindByEmailAsync(model.Email);
if (user is not null)
{
SignInResult result = await _signInManager.PasswordSignInAsync( SignInResult result = await _signInManager.PasswordSignInAsync(
user, user,
model.Password, model.Password,
...@@ -71,7 +73,7 @@ namespace PhoneStore.Services ...@@ -71,7 +73,7 @@ namespace PhoneStore.Services
); );
if (result.Succeeded) if (result.Succeeded)
return new IdentityResult {StatusCodes = StatusCodes.Success}; return new IdentityResult {StatusCodes = StatusCodes.Success};
}
return new IdentityResult return new IdentityResult
{ {
StatusCodes = StatusCodes.Error, 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