Get password when user registers and save it sha1 into database

im working on a website where the users can connect with iphone to some functions of it by using a sha1 encrypted password. In other words the plain password of wordpress encrypted in sha1.

In the past i did the silly thing of editing the core files of wordpress to get the password when the user register and save that password in sha1 on the wp_users table.

Of course my client updated wordpress and all the functions were lost. Yeah im stupid, im not sure what i was thinking that day.

There is any way to hook to the register function to get the password , encrypt it in sha1 format and storeit in the database from the functions.php file of my theme?

Any ideas?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Have a look at Pluggable Functions in /wp-includes/pluggable.php. You can safely replace the password generating/checking functions with your own.

Method 2

You can hook into wp_check_password(), which does this at end:

return apply_filters('check_password', $check, $password, $hash, $user_id);

If $check is true then $password is current valid pass for $user_id.

Note that this will only work next time specific user logins. You can’t just retrieve plan text passwords for all accounts.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x