public async Task <User> AuthenticationUser(string email, string password) { var user = await _serviceManageUser.GetUserByEmail(email); var passwordPassed = new ManagePassword().ValidatePassword(password, user.Hash); if (!(user is null) && passwordPassed) { return(user); } return(null); }
public async Task <IActionResult> AuthenticateUser(string email, string senha) { var user = await _serviceManageUser.GetUserByEmail(email); if (user is null) { return(BadRequest("Usuário ou senha inválidos")); } user = await _serviceAuthentication.AuthenticationUser(email, senha); if (user is null) { return(BadRequest("Usuário ou senha inválidos")); } return(Ok(_serviceAuthentication.AuthorizationTokenUser(user))); }