Created
June 7, 2016 11:40
-
-
Save pitbulk/a8223c90a3534e9a7d5e0a93009a094f to your computer and use it in GitHub Desktop.
This script sanitize @@@nopass@@@ passwords generated by OneLogin SAML plugin <= 2.1.8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This script search user with @@@nopass@@@ passwords and replace them by random passwords | |
*/ | |
/** Sets up the WordPress Environment. */ | |
require( dirname(__FILE__) . '/wp-load.php' ); | |
$users = get_users(); | |
foreach ($users as $user) { | |
$user = wp_authenticate($user->user_login, '@@@nopass@@@'); | |
if (!is_wp_error($user) ) { | |
$user->user_pass = wp_generate_password(20, true); | |
wp_update_user($user); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We've created an enhanced version of this script that fits our use case better https://gist.github.com/TheLastCicada/97d3fd6d66f0301691b8bce315aeeb60 and provides feedback about what is happening when the script is running. You are welcome to integrate any changes into your script here if desired.