Jammer
Jammer

Reputation: 2420

Membership ChangePassword (hashed) match current password against old password field

I am implementing a system where the user can Reset their password if they have forgotten it.

Once it is reset I want to give them the option of changing the password so that it will be something more memorable to them.

The password is hashed and if i enter in the correct old password and new password the password does change.

If I enter in the wrong old password and new password the password doesnt change.

Is there a way to match the old password with the old password field in code behind so I can throw up an error to the user to tell them what is wrong?

I have tried:

Dim currentUser As MembershipUser = Membership.GetUser()
currentUser.GetPassword()

But this won't work I think because the password is hashed.

Thanks.

Upvotes: 0

Views: 721

Answers (1)

Paul
Paul

Reputation: 36349

Not that I'm aware of, but the ChangePassword method returns a bool (true if successful, false if not), so why not just throw up your message on a false result?

Upvotes: 1

Related Questions