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

parent 81efc36c
...@@ -63,15 +63,17 @@ namespace PhoneStore.Services ...@@ -63,15 +63,17 @@ 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);
SignInResult result = await _signInManager.PasswordSignInAsync( if (user is not null)
user, {
model.Password, SignInResult result = await _signInManager.PasswordSignInAsync(
model.RememberMe, user,
false model.Password,
); model.RememberMe,
if (result.Succeeded) false
return new IdentityResult {StatusCodes = StatusCodes.Success}; );
if (result.Succeeded)
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