Make WordPress Core


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

Introduce NONCE_SALT and NONCE_KEY

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.