public void RegisterUser(string name, string surname, DateTime dateOfBirth, string email, string password, DBSelection selectDB) { PasswordEncrypter encrypter = new PasswordEncrypter(); RegisterUserInDb registration = new RegisterUserInDb(); registration.RegisterUserInDB(name, surname, dateOfBirth, email, encrypter.encryptPassword(password), selectDB); }
public bool CredentialsCorrect(string email, string password) { GetUserFromDB getUser = new GetUserFromDB(password, email); LoggedInUser = new User(); getUser.Execute(LoggedInUser); PasswordEncrypter encrypter = new PasswordEncrypter(); if (LoggedInUser.Password == encrypter.encryptPassword(password) && LoggedInUser.Email == email) { return(true); } else { return(false); } }
public override void ExecuteCommand(User obj) { PasswordEncrypter encrypter = new PasswordEncrypter(); command.CommandText = "SELECT * FROM users WHERE Email = @Email AND Password = @Password LIMIT 1;"; command.Parameters.AddWithValue("@Email", email); command.Parameters.AddWithValue("@Password", encrypter.encryptPassword(password)); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { obj.UserID = (int)reader["ID"]; obj.Name = (string)reader["FirstName"]; obj.Surname = (string)reader["LastName"]; obj.DateOfBirth = (DateTime)reader["DateOfBirth"]; obj.Email = (string)reader["Email"]; obj.Password = (string)reader["Password"]; } } }