/// <summary> /// Processes a request to update the password for a membership user. /// </summary> /// <param name="username">The user to update the password for.</param> /// <param name="oldPassword">The current password for the specified user.</param> /// <param name="newPassword">The new password for the specified user.</param> /// <returns> /// true if the password was updated successfully; otherwise, false. /// </returns> public override bool ChangePassword(string username, string oldPassword, string newPassword) { Business.UserDataService userData = new UserDataService(_currentUser, _userDao, _properties); userData.UserName = username; userData.Password = oldPassword; if (userData.ValidateUser(oldPassword)) { return(false); } ValidatePasswordEventArgs args = new ValidatePasswordEventArgs(username, newPassword, true); OnValidatingPassword(args); if (args.Cancel) { if (args.FailureInformation != null) { throw args.FailureInformation; } else { throw new MembershipPasswordException("Change password canceled due to new password validation failure."); } } CustomMembershipUser customUser = new CustomMembershipUser(userData); return(customUser.ChangePassword(oldPassword, newPassword)); }
/// <summary> /// Verifies that the specified user name and password exist in the data source. /// </summary> /// <param name="username">The name of the user to validate.</param> /// <param name="password">The password for the specified user.</param> /// <returns> /// true if the specified username and password are valid; otherwise, false. /// </returns> public override bool ValidateUser(string username, string password) { Business.UserDataService user = new UserDataService(_currentUser, _userDao, _properties); user.UserName = username; user.Password = password; return(user.ValidateUser(password)); }
/// <summary> /// Processes a request to update the password question and answer for a membership user. /// </summary> /// <param name="username">The user to change the password question and answer for.</param> /// <param name="password">The password for the specified user.</param> /// <param name="newPasswordQuestion">The new password question for the specified user.</param> /// <param name="newPasswordAnswer">The new password answer for the specified user.</param> /// <returns> /// true if the password question and answer are updated successfully; otherwise, false. /// </returns> public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer) { Business.UserDataService userData = new UserDataService(_currentUser, _userDao, _properties); userData.UserName = username; userData.Password = password; userData.PasswordQuestion = newPasswordQuestion; userData.PasswordAnswer = newPasswordAnswer; if (!userData.ValidateUser(password)) { return(false); } CustomMembershipUser customUser = new CustomMembershipUser(userData); return(customUser.ChangePasswordQuestionAndAnswer(password, newPasswordQuestion, newPasswordAnswer)); }