Skip to content

Instantly share code, notes, and snippets.

@pitbulk
Created June 7, 2016 11:40
Show Gist options
  • Save pitbulk/a8223c90a3534e9a7d5e0a93009a094f to your computer and use it in GitHub Desktop.
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
<?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);
}
}
@TheLastCicada
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment