public async Task <User> Authenticate(string email, string password) { var user = await Task.Run(() => _context.Users.ToList().SingleOrDefault( u => u.Email == email && PasswordHasher.ComparePasswords(password, u))); if (user == null) { return(null); } return(user); }
private void btnLogin_Click(object sender, EventArgs e) { try { string username = txtUser.Text; string password = txtPassword.Text; bool status = PasswordHasher.ComparePasswords(username, password); if (status) { StartNewWindow(new FormFrontPage()); } } catch (FaultException <DbConnectionError> exception) { MessageBox.Show(exception.Detail.Message, "Fejl"); } catch (FaultException <EmployeeNotExistException> exception) { MessageBox.Show(exception.Detail.Message, "Fejl"); } }