public static async Task <APIResponse <string> > LoginUserAsync(string emailAddress, string password) { LoginUserParameters parameters = new LoginUserParameters() { EmailAddress = emailAddress, Password = password, }; return(await PostAsync <string>("api/users/login", parameters)); }
public async Task <ActionResult <string> > LoginUser(LoginUserParameters parameters) { parameters.EmailAddress = parameters.EmailAddress.ToLower(); var user = await Db.Users.FirstOrDefaultAsync(x => x.Email == parameters.EmailAddress); if (user == null) { return(BadRequest("Invalid emailadress / password")); } if (!PasswordSecurity.ComparePassword(parameters.Password, user)) { return(BadRequest("Invalid emailadress / password")); } return(AccessToken.Generate(user.Email)); }