public bool authenticate(string userEmail, string pass) { UserDaoImpl userDao = new UserDaoImpl(); Credentials creds = userDao.getCredentialsByEmail(userEmail); if (creds.Password.Equals(pass)) { return true; } else return false; }
public bool authenticate(string userEmail, string pass) { bool valid = false; UserDaoImpl user = new UserDaoImpl(); Credentials c = user.getCredentialsByEmail(userEmail); Credentials inputCreds = new Credentials(userEmail, pass); if (c.Password.Equals(inputCreds.Password) && c.Email.Equals(inputCreds.Email)) { User u = user.getUserByEmail(c.Email); valid = true; } return valid; }
public bool isAdmin(string userEmail, string pass) { bool admin = false; UserDaoImpl user = new UserDaoImpl(); Credentials c = user.getCredentialsByEmail(userEmail); if (c != null) { User u = user.getUserByEmail(c.Email); if (u.Admin) { admin = true; } } return admin; }