I have a password reset page that I created for my employees and for the UserPrincipal
object, I perform the following:
UserPrincipal user = Helpers.LDAPHelper.GetUserPrincipal(model.EmailAddress);
string temporary = Membership.GeneratePassword(12, 4);
user.SetPassword(temporary);
user.ChangePassword(temporary, model.ConfirmPassword);
The user.SetPassword
call works fine, but does not trigger that the password has changed, so any password age tracking that I do (to remind users to reset their password before it expires) does not work. So, I wanted to since the ChangePassword
method requires the current password, I set a temporary password and then use that as the current. BUT, it throws a PasswordException
every time:
"The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements. (Exception from HRESULT: 0x800708C5)"
Can someone tell me what I'm doing wrong?
It should be the new password that is throwing the exception, is the new one a string? Also, could there be password policy other than that one such as a default policy.
User contributions licensed under CC BY-SA 3.0