public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
        {
            string hash = EncryptPassword(password);
            DateTime dateNow = DateTime.Now;

            BugTrackerUser bugTrackerUser = new BugTrackerUser {
                   UserName = username,
                   Password = hash,
                   Email = email,
                   CreationDate = dateNow,
                   LastActivityDate = dateNow,
                   LastLoginDate = dateNow
            };

            CustomUser user = new CustomUser("BugTrackerMembershipProvider", passwordQuestion, bugTrackerUser);

            status = MembershipCreateStatus.Success;
            return user;
        }
        public override bool ValidateUser(string username, string password)
        {
            if(string.IsNullOrEmpty(password.Trim())) return false;
            string hash = EncryptPassword(password);

            BugTrackerUser user = GetByUserName(username);
            if(user == null) return false;
            if(user.Password == hash)
            {
                this.User = user;
                return true;
            }
            return false;
        }
예제 #3
0
 public CustomUser(string providername,
     string passwordQuestion,
     BugTrackerUser userAccount
     )
     : base(providername,
                userAccount.UserName,
                userAccount.BugTrackerUserId,
                userAccount.Email,
                passwordQuestion,
                string.Empty,
                true,
                false,
                userAccount.CreationDate,
                userAccount.LastLoginDate,
                userAccount.LastActivityDate,
                new DateTime(),
                new DateTime())
 {
     UserAccount = userAccount;
 }