Beispiel #1
0
        public bool AuthenticateUser(string username, string password)
        {
            IMemberRepository mr = new MemberRepository();
            Member member = mr.GetByUsername(username);
            if (member == null)
                return false;

            string passwordHash = FormsAuthentication.HashPasswordForStoringInConfigFile(password+username, "sha1");
            return member.Password == passwordHash;
        }
Beispiel #2
0
        public bool ChangePassword(string username, string oldPassword, string newPassword)
        {
            IMemberRepository mr = new MemberRepository();
            Member member = mr.GetByUsername(username);
            if (member == null)
                return false;

            string oldPasswordHash = FormsAuthentication.HashPasswordForStoringInConfigFile(oldPassword, "sha1");
            if (member.Password != oldPasswordHash)
                return false;

            string newPasswordHash = FormsAuthentication.HashPasswordForStoringInConfigFile(newPassword, "sha1");
            member.Password = newPasswordHash;
            try
            {
                mr.Update(member);
            }
            catch
            {
                return false;
            }

            return true;
        }
Beispiel #3
0
 public Member GetMember(string userName)
 {
     IMemberRepository mr = new MemberRepository();
     return mr.GetByUsername(userName);
 }
Beispiel #4
0
        public Member FindMember(string memberIdentification)
        {
            IMemberRepository mr = new MemberRepository();

            var member = mr.GetByEmail(memberIdentification);
            if (member != null)
                return member;

            member = mr.GetByUsername(memberIdentification);
            if (member != null)
                return member;

            return null;
        }