Пример #1
0
        public override string GetPassword(string username, string answer)
        {
            var oldPassword = AccountDataProvider.GetPassByUserName(username);

            if (oldPassword == null)
            {
                return(null);
            }
            return(oldPassword);
        }
Пример #2
0
        public override bool ValidateUser(string username, string password)
        {
            GetMD5Hash(password);
            var user = string.Empty;

            user = AccountDataProvider.GetUserByUserName(username, password);
            if (user != null)
            {
                return(true);
            }
            return(false);
        }
Пример #3
0
        public override MembershipUser GetUser(string username, bool userIsOnline)
        {
            var user = AccountDataProvider.GetAllUsers().SingleOrDefault(u => u.UserName == username);

            if (user != null)
            {
                var memberUser = new MembershipUser("CustomMembershipProvider", username, user.GIDUser, string.Empty,
                                                    string.Empty, string.Empty, true, false, DateTime.MinValue,
                                                    DateTime.MinValue, DateTime.MinValue,
                                                    DateTime.Now, DateTime.Now);
                return(memberUser);
            }
            return(null);
        }
Пример #4
0
        public bool CheckPassword(string username, string password)
        {
            var typedPass = password;

            var dbpassword = AccountDataProvider.GetPassByUserName(username);



            if (typedPass.ToLower() == dbpassword.ToLower())
            {
                return(true);
            }

            return(false);
        }
Пример #5
0
        public bool ChangePassword(string userName, string oldPassword, string newPassword)
        {
            var currentUser = AccountDataProvider.GetAllUsers().SingleOrDefault(u => u.UserName == userName);

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



            if (!CheckPassword(userName, oldPassword))
            {
                return(false);
            }
            return(ValidateUser(userName, oldPassword));
        }
Пример #6
0
        public bool ValidateUser(string username, string password)
        {
            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentException("Value cannot be null or empty", "username");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentException("Value cannot be null or empty", "password");
            }
            var user = string.Empty;

            user = AccountDataProvider.GetUserByUserName(username, password);
            if (user != null)
            {
                return(true);
            }
            return(false);
        }