Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there anyway to get the password string from the login form?

share|improve this question
1  
It would be a huge security hole if there were. –  vancoder Mar 27 '13 at 21:37
1  
@vancoder, you would be right if the user was asking how to retrieve the unhashed password from the DB, but the plaintext is seen when the user initially sets their password. That's how any plugin that enforces a level of password security functions. –  Dan Mar 27 '13 at 22:04
add comment

2 Answers 2

up vote 2 down vote accepted

this should do the job, just add it to functions.php or put in a plugin:

add_filter( 'wp_authenticate_user', 'my_authenticate_user', 10, 2 );

function my_authenticate_user( $user, $password ) {

    // do whatever you want with the $password variable here

    return $user;

}
share|improve this answer
    
thanks a lot. it works perfectly :) –  тнє Sufi Mar 27 '13 at 22:22
    
just out of curiosity, what are you using it for? –  Simon Blackbourn Mar 27 '13 at 22:29
    
Well, it does get the password from the login form, but does not get the password string, when someone updates their password. Any idea how to get that? I mainly need the password from the update profile form. I need to send this passowrd string to an external API, to update password for that user in an external system at the same time. –  тнє Sufi Mar 27 '13 at 22:42
    
the only way i can see to do this is to hook into the user_profile_update_errors action (line 153 of wp-admin/includes/user.php). the plaintext password is stored in $user->user_pass (if it has been set), but you'll need to check that there are no password errors. –  Simon Blackbourn Mar 27 '13 at 23:15
add comment

Look at the form markup:

<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" />

So $_POST['pwd'] is the password.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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