Пример #1
0
        public override string CreateAccount(string userName, string password, bool requireConfirmationToken)
        {
            var account = new LocalUser {
                UserName = userName, Password = PasswordUtiltity.OneWayHash(password)
            };

            _userDao.Insert(account);
            return(userName);
        }
Пример #2
0
        public override string CreateUserAndAccount(string userName, string password, bool requireConfirmation, IDictionary <string, object> values)
        {
            var account = new LocalUser {
                UserName = userName, Password = PasswordUtiltity.OneWayHash(password)
            };

            _userDao.Insert(account);
            return(userName);
        }
Пример #3
0
        public override bool ValidateUser(string username, string password)
        {
            var account = _userDao.LoadByUserName(username);

            if (account == null)
            {
                return(false);
            }

            return(PasswordUtiltity.PasswordMatch(password, account.Password));
        }
Пример #4
0
        public override bool ChangePassword(string username, string oldPassword, string newPassword)
        {
            var account = _userDao.LoadByUserName(username);

            if (account == null)
            {
                return(false);
            }

            if (PasswordUtiltity.PasswordMatch(oldPassword, account.Password))
            {
                account.Password = PasswordUtiltity.OneWayHash(newPassword);
                _userDao.UpdateAccount(account);
            }

            return(false);
        }
Пример #5
0
        public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
        {
            var account = _userDao.LoadByUserName(username);

            if (account == null)
            {
                return(false);
            }

            if (PasswordUtiltity.PasswordMatch(password, account.Password))
            {
                account.PasswordQuestion = newPasswordQuestion;
                account.PasswordAnswer   = newPasswordAnswer;
                _userDao.UpdateAccount(account);
                return(true);
            }

            return(false);
        }
Пример #6
0
        public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
        {
            var account = new LocalUser
            {
                Email            = email,
                IsApproved       = true,
                Password         = PasswordUtiltity.OneWayHash(password),
                PasswordAnswer   = passwordAnswer,
                PasswordQuestion = passwordQuestion,
                ProviderUserKey  = providerUserKey,
                UserName         = username,
            };

            //repo.add


            status = MembershipCreateStatus.Success;

            return(GetUser(username, userIsOnline: true));
        }