Frank Vèssia Posted September 22, 2011 Posted September 22, 2011 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.
Soma Posted September 22, 2011 Posted September 22, 2011 Have you tried $user->pass for getting the current passwort and compare? $user->pass returns encrypted password.
Frank Vèssia Posted September 22, 2011 Author Posted September 22, 2011 I know $user->pass returns encrypted pass for this reason i need the code to create an encrypted pass for comparing...i don't think it's a simple md5 encryption
Soma Posted September 22, 2011 Posted September 22, 2011 sorry I confused something... I meant decrypted, but that's false anyway. have a look at FieldtypePassword.module ...
Soma Posted September 22, 2011 Posted September 22, 2011 just checked: you should be able to compare $user->pass->matches('string'); returns true if it matches.
ryan Posted September 22, 2011 Posted September 22, 2011 Soma's suggestion is correct–thanks Soma! Another way to do the same thing: if($session->authenticate($user, $old_pass)) { $user->pass = $new_pass; } 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now