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); }