WordPress.org

Make WordPress Core

Changeset 10120


Ignore:
Timestamp:
12/07/2008 09:31:13 PM (11 years ago)
Author:
ryan
Message:

Introduce NONCE_SALT and NONCE_KEY

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-config-sample.php

    r8817 r10120  
    4545define('SECURE_AUTH_KEY', 'put your unique phrase here');
    4646define('LOGGED_IN_KEY', 'put your unique phrase here');
     47define('NONCE_KEY', 'put your unique phrase here');
    4748/**#@-*/
    4849
  • trunk/wp-includes/pluggable.php

    r9775 r10120  
    11601160
    11611161    // Nonce generated 0-12 hours ago
    1162     if ( substr(wp_hash($i . $action . $uid), -12, 10) == $nonce )
     1162    if ( substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) == $nonce )
    11631163        return 1;
    11641164    // Nonce generated 12-24 hours ago
    1165     if ( substr(wp_hash(($i - 1) . $action . $uid), -12, 10) == $nonce )
     1165    if ( substr(wp_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) == $nonce )
    11661166        return 2;
    11671167    // Invalid nonce
     
    11851185    $i = wp_nonce_tick();
    11861186
    1187     return substr(wp_hash($i . $action . $uid), -12, 10);
     1187    return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10);
    11881188}
    11891189endif;
     
    12731273            }
    12741274        }
     1275    } elseif ( 'nonce' == $scheme ) {
     1276        if ( defined('NONCE_KEY') && ('' != NONCE_KEY) && ( $wp_default_secret_key != NONCE_KEY) )
     1277            $secret_key = NONCE_KEY;
     1278
     1279        if ( defined('NONCE_SALT') ) {
     1280            $salt = NONCE_SALT;
     1281        } else {
     1282            $salt = get_option('nonce_salt');
     1283            if ( empty($salt) ) {
     1284                $salt = wp_generate_password();
     1285                update_option('nonce_salt', $salt);
     1286            }
     1287        }
    12751288    } else {
    12761289        // ensure each auth scheme has its own unique salt
Note: See TracChangeset for help on using the changeset viewer.