/// <summary> /// Change the password for a 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) { CosmoMongerMembershipUser user = (CosmoMongerMembershipUser)this.GetUser(username, true); if (user != null) { return(user.ChangePassword(oldPassword, newPassword)); } return(false); }
/// <summary> /// Resets a user's password to a new, automatically generated password. /// </summary> /// <param name="username">The user to reset the password for.</param> /// <param name="answer">The password answer for the specified user.</param> /// <returns>The new password for the specified user.</returns> public override string ResetPassword(string username, string answer) { CosmoMongerMembershipUser user = (CosmoMongerMembershipUser)this.GetUser(username, false); if (user != null && user.CheckResetPasswordCode(answer)) { string newPassword = Membership.GeneratePassword(8, 0); if (user.ChangePassword(newPassword)) { return(newPassword); } } return(String.Empty); }