0

Possible Duplicate:
How can I get the real password via hook_user_update()?

I want to change the current user password, and get the new password(the real password, not md5 encryption) when edit the account profile via user profile form(e.g.: example.com/user/1/edit) and save. would anyone can tell me how to do that? I tried using hook_user_update(), but it didn't succeed.

  • I mean I want to change the current user password, and I want to get the new password. – Brian Lau Sep 27 '12 at 5:45
  • sorry, I dont know, how to delete this question? – Brian Lau Sep 27 '12 at 8:00
4

You cannot decrypt the password due to security reasons. Drupal 7 uses SHA512 by default with a salt. It will perform multiple hashes on the password. It's highly impossible to decrypt password.

See the better explanation provided here.

To reset the password see the solution provided here.

  • I just want to receive the new password via form widget (drupal 7 this widget's id is :edit-pass-pass1), and use this password to single sign on with other system. In order to make data synchronization,when password has changed, another system will changed at the same time. – Brian Lau Sep 27 '12 at 5:53
  • 1
    You can form alter the widget form and get the value using $form_state['values'], call the additional submit function to sync to another system . But, it's a not recommended to read user passwords, ideal way is to encrypt passwords and store them in another system too ! – Anil Sagar Sep 27 '12 at 6:09
  • Do you mean to use hook_form_alter()? – Brian Lau Sep 27 '12 at 6:14
  • Yes, Use hook_form_alter, but i strongly recommend encrypting passwords in another system too.. ! – Anil Sagar Sep 27 '12 at 6:14
  • 1
    you need to write a custom module, and define the function MYMODULE_form_user_register_form_alter(), where MYMODULE is the name of your module. It actually implements hook_form_FORM_ID_alter, (the form_id for the form can be found in a hidden field, in this case it's user_register_form) as found here: api.drupal.org/api/drupal/modules!system!system.api.php/…. – jenlampton Mar 19 '13 at 5:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.