Frank Vèssia Posted September 22, 2011 Share 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. Link to comment Share on other sites More sharing options...
Soma Posted September 22, 2011 Share Posted September 22, 2011 Have you tried $user->pass for getting the current passwort and compare? $user->pass returns encrypted password. Link to comment Share on other sites More sharing options...
Frank Vèssia Posted September 22, 2011 Author Share 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 Link to comment Share on other sites More sharing options...
Soma Posted September 22, 2011 Share Posted September 22, 2011 sorry I confused something... I meant decrypted, but that's false anyway. have a look at FieldtypePassword.module ... Link to comment Share on other sites More sharing options...
Soma Posted September 22, 2011 Share Posted September 22, 2011 just checked: you should be able to compare $user->pass->matches('string'); returns true if it matches. Link to comment Share on other sites More sharing options...
Frank Vèssia Posted September 22, 2011 Author Share Posted September 22, 2011 thanks i will try Link to comment Share on other sites More sharing options...
ryan Posted September 22, 2011 Share 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 Link to comment Share on other sites More sharing options...
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