Jump to content

Recommended Posts

Posted

I'm creating a password change form with 3 fields, old_pass, new_pass and confirm_pass. What i need is the code for crypting a pass for comparing the old_pass with the pass stored in db.

Posted

Have you tried $user->pass for getting the current passwort and compare? $user->pass returns encrypted password.

Posted

sorry I confused something... I meant decrypted, but that's false anyway. :D

have a look at FieldtypePassword.module ...

Posted

just checked:

you should be able to compare $user->pass->matches('string'); returns true if it matches.

Posted

Soma's suggestion is correct–thanks Soma! Another way to do the same thing:

if($session->authenticate($user, $old_pass)) {
    $user->pass = $new_pass; 
}
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...