public RegisterResult RegisterUser(RegisterModel user) { if (_accountAccess.UserExists(user.Email)) { return(RegisterResult.EmailExists); } if (_accountAccess.UserExists("", user.Username)) { return(RegisterResult.UsernameExists); } if (user.Password.Length < 4) { return(RegisterResult.PasswordShort); } if (user.Username.Length < 4) { return(RegisterResult.UsernameShort); } EncryptedPassword encryptPass = PasswordEncryptor.EncryptPassword(user.Password); _accountAccess.CreateUserAccount(user.Username, user.Email, encryptPass.PasswordKey, encryptPass.PasswordSalt); return(RegisterResult.Succeeded); }
public static bool RegisterUser(IAccountAccess accountAccess, string username, string email, string password) { EncryptedPassword encryptedPassword = PasswordEncryptor.EncryptPassword(password); return(accountAccess.CreateUserAccount(username, email, encryptedPassword.PasswordKey, encryptedPassword.PasswordSalt)); }