public override bool ValidateUser(string username, string password) { UserBL userBL = new UserBL(); string salt = userBL.GetSalt(username); if (salt != null && salt != string.Empty) { password = userBL.hashPassword(password, salt); return userBL.ValidateUser(username, password); } return false; }
public override string GetUserNameByEmail(string email) { string username = string.Empty; UserBL userBL = new UserBL(); User userTable = userBL.GetUser(email); if (userTable != null) username = userTable.Username; return username; }
public MembershipUser NewUser(string username, string password, string email, string firstName, string lastName, UserRole userRole, bool isApproved, out MembershipCreateStatus status) { ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, password, true); OnValidatingPassword(args); if (args.Cancel) { status = MembershipCreateStatus.InvalidPassword; return null; } if (RequiresUniqueEmail && GetUserNameByEmail(email) != "") { status = MembershipCreateStatus.DuplicateEmail; return null; } //status = MembershipCreateStatus.InvalidAnswer; MembershipUser user = GetUser(email, false); if (user == null) { UserBL userBL = new UserBL(); string salt = userBL.getSalt(); password = userBL.hashPassword(password, salt); if (userBL.Save(FirstName, LastName, username, password, email, UserRole.ID, salt, 0) > 0) status = MembershipCreateStatus.Success; else status = MembershipCreateStatus.UserRejected; } else status = MembershipCreateStatus.DuplicateUserName; return null; }
public override MembershipUser GetUser(string username, bool userIsOnline) { MembershipUser user = null; UserBL userBL = new UserBL(); User userTable = userBL.GetUserByUsername(username); if (userTable!=null) { user = new MembershipUser("CustomMembershipProvider", username, userTable.ID, string.Empty, null, null, true, false, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now); } return user; }