Created
July 22, 2019 10:03
-
-
Save ntakouris/de89c8c205bdaacf95e1770dc55f4f8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<AuthenticationResult> LoginAsync(string email, string password) | |
{ | |
var user = await _userManager.FindByEmailAsync(email); | |
if (user == null) | |
{ | |
return new AuthenticationResult | |
{ | |
Errors = new[] {"User does not exist"} | |
}; | |
} | |
var userHasValidPassword = await _userManager.CheckPasswordAsync(user, password); | |
if (!userHasValidPassword) | |
{ | |
return new AuthenticationResult | |
{ | |
Errors = new[] {"User/password combination is wrong"} | |
}; | |
} | |
return await GenerateAuthenticationResultForUserAsync(user); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment