public void CreateAccount(IFlexMembershipUser user)
        {
            var existingUser = _userStore.GetUserByUsername(user.Username);

            if (existingUser != null)
            {
                throw new MembershipCreateUserException("Cannot register with a duplicate username");
            }

            user.Salt     = user.Salt ?? _encoder.GenerateSalt();
            user.Password = _encoder.Encode(user.Password, user.Salt);
            _userStore.Add(user);
        }
Esempio n. 2
0
        /// <summary>
        ///   Creates an account.
        /// </summary>
        /// <param name="user"> The user. </param>
        public void CreateAccount(IFlexMembershipUser user)
        {
            IFlexMembershipUser existingUser = _userStore.GetUserByUsername(user.Username);

            if (existingUser != null)
            {
                throw new FlexMembershipException(FlexMembershipStatus.DuplicateUserName);
            }

            user.Salt     = user.Salt ?? _encoder.GenerateSalt();
            user.Password = _encoder.Encode(user.Password, user.Salt);
            _userStore.Add(user);
        }