public override async Task <AuthenticationResult> Validate() { var password = authenticationStrategy.Cryptography.Decrypt(authenticationStrategy.UserModel.Password); if (!await authenticationStrategy.UserManager.CheckPasswordAsync(authenticationStrategy.IdentityUser, password)) { await authenticationStrategy.UserManager.AccessFailedAsync(authenticationStrategy.IdentityUser); return(AuthenticationResult.NotSucceeded("Invalid email or password.")); } return(AuthenticationResult.Succeeded()); }
public override async Task <AuthenticationResult> Validate() { var password = authenticationStrategy.Cryptography.Decrypt(authenticationStrategy.UserModel.Password); var result = await authenticationStrategy.SignInManager.PasswordSignInAsync(authenticationStrategy.UserModel.Email, password, true, false); if (!result.Succeeded) { return(AuthenticationResult.NotSucceeded("Invalid email or password.")); } return(AuthenticationResult.Succeeded()); }
public override async Task <AuthenticationResult> Validate() { var user = await authenticationStrategy.UserManager.FindByEmailAsync(authenticationStrategy.UserModel.Email); if (user == null) { return(AuthenticationResult.NotSucceeded("Invalid email or password.")); } else { authenticationStrategy.IdentityUser = user; return(AuthenticationResult.Succeeded()); } }