simple-jwt-authentication icon indicating copy to clipboard operation
simple-jwt-authentication copied to clipboard

Tokens updated on pwd update

Open tribalboy3000 opened this issue 8 years ago • 2 comments

Can you set it up so when a password is updated it automatically deletes all that users tokens?

tribalboy3000 avatar Jul 31 '17 12:07 tribalboy3000

I solved the problem adding the following to my functions.php:

add_action('after_password_reset', 'revoke_all_tokens', 10, 2);
function revoke_all_tokens($user, $password) {
    delete_user_meta( $user->ID, 'jwt_data' );
    return true;
}

OmbraDiFenice avatar Jan 19 '19 19:01 OmbraDiFenice

Hi!

That's a good idea! I'll be sure to add it in when I find the time! I'll also accept a PR :)

jonathan-dejong avatar Jan 26 '19 13:01 jonathan-dejong