示例#1
0
        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);
        }
示例#2
0
        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));
        }