| 1322 | | if ( defined('AUTH_SALT') && ('' != AUTH_SALT) && ( $wp_default_secret_key != AUTH_SALT) ) { |
| 1323 | | $salt = AUTH_SALT; |
| 1324 | | } elseif ( defined('SECRET_SALT') && ('' != SECRET_SALT) && ( $wp_default_secret_key != SECRET_SALT) ) { |
| 1325 | | $salt = SECRET_SALT; |
| 1326 | | } else { |
| 1327 | | $salt = get_site_option('auth_salt'); |
| 1328 | | if ( empty($salt) ) { |
| 1329 | | $salt = wp_generate_password( 64, true, true ); |
| 1330 | | update_site_option('auth_salt', $salt); |
| | 1321 | if ( in_array( $scheme, array( 'auth', 'secure_auth', 'logged_in', 'nonce' ) ) ) { |
| | 1322 | foreach ( array( 'key', 'salt' ) as $type ) { |
| | 1323 | $const = strtoupper( "{$scheme}_{$type}" ); |
| | 1324 | if ( constant( $const ) && $wp_default_secret_key != constant( $const ) ) { |
| | 1325 | $$type = constant( $const ); |
| | 1326 | } elseif ( ! $$type ) { |
| | 1327 | $$type = get_site_option( "{$scheme}_{$type}" ); |
| | 1328 | if ( ! $$type ) { |
| | 1329 | $$type = wp_generate_password( 64, true, true ); |
| | 1330 | update_site_option( "{$scheme}_{$type}", $$type ); |
| | 1331 | } |
| 1333 | | } elseif ( 'secure_auth' == $scheme ) { |
| 1334 | | if ( defined('SECURE_AUTH_KEY') && ('' != SECURE_AUTH_KEY) && ( $wp_default_secret_key != SECURE_AUTH_KEY) ) |
| 1335 | | $secret_key = SECURE_AUTH_KEY; |
| 1336 | | |
| 1337 | | if ( defined('SECURE_AUTH_SALT') && ('' != SECURE_AUTH_SALT) && ( $wp_default_secret_key != SECURE_AUTH_SALT) ) { |
| 1338 | | $salt = SECURE_AUTH_SALT; |
| 1339 | | } else { |
| 1340 | | $salt = get_site_option('secure_auth_salt'); |
| 1341 | | if ( empty($salt) ) { |
| 1342 | | $salt = wp_generate_password( 64, true, true ); |
| 1343 | | update_site_option('secure_auth_salt', $salt); |
| | 1334 | } else { |
| | 1335 | if ( ! $key ) { |
| | 1336 | $key = get_site_option( 'secret_key' ); |
| | 1337 | if ( ! $key ) { |
| | 1338 | $key = wp_generate_password( 64, true, true ); |
| | 1339 | update_site_option( 'secret_key' ); |
| 1346 | | } elseif ( 'logged_in' == $scheme ) { |
| 1347 | | if ( defined('LOGGED_IN_KEY') && ('' != LOGGED_IN_KEY) && ( $wp_default_secret_key != LOGGED_IN_KEY) ) |
| 1348 | | $secret_key = LOGGED_IN_KEY; |
| 1349 | | |
| 1350 | | if ( defined('LOGGED_IN_SALT') && ('' != LOGGED_IN_SALT) && ( $wp_default_secret_key != LOGGED_IN_SALT) ) { |
| 1351 | | $salt = LOGGED_IN_SALT; |
| 1352 | | } else { |
| 1353 | | $salt = get_site_option('logged_in_salt'); |
| 1354 | | if ( empty($salt) ) { |
| 1355 | | $salt = wp_generate_password( 64, true, true ); |
| 1356 | | update_site_option('logged_in_salt', $salt); |
| 1357 | | } |
| 1358 | | } |
| 1359 | | } elseif ( 'nonce' == $scheme ) { |
| 1360 | | if ( defined('NONCE_KEY') && ('' != NONCE_KEY) && ( $wp_default_secret_key != NONCE_KEY) ) |
| 1361 | | $secret_key = NONCE_KEY; |
| 1362 | | |
| 1363 | | if ( defined('NONCE_SALT') && ('' != NONCE_SALT) && ( $wp_default_secret_key != NONCE_SALT) ) { |
| 1364 | | $salt = NONCE_SALT; |
| 1365 | | } else { |
| 1366 | | $salt = get_site_option('nonce_salt'); |
| 1367 | | if ( empty($salt) ) { |
| 1368 | | $salt = wp_generate_password( 64, true, true ); |
| 1369 | | update_site_option('nonce_salt', $salt); |
| 1370 | | } |
| 1371 | | } |
| 1372 | | } else { |
| 1373 | | // ensure each auth scheme has its own unique salt |
| 1374 | | $salt = hash_hmac('md5', $scheme, $secret_key); |
| | 1342 | $salt = hash_hmac( 'md5', $scheme, $key ); |