Make WordPress Core

Ticket #5365: 5365.2.diff

File 5365.2.diff, 1.9 KB (added by xknown, 17 years ago)

Complete patch

  • wp-login.php

     
    6868        }
    6969} // End of login_header()
    7070
    71 
     71$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
    7272switch ($action) {
    7373
    7474case 'logout' :
     
    9090        $user_login = '';
    9191        $user_pass = '';
    9292
    93         if ( $_POST ) {
     93        if ( $http_post ) {
    9494                if ( empty( $_POST['user_login'] ) )
    9595                        $errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.');
    9696                if ( empty( $_POST['user_email'] ) )
     
    212212                exit();
    213213        }
    214214
    215         if ( $_POST ) {
     215        if ( $http_post ) {
    216216                require_once( ABSPATH . WPINC . '/registration.php');
    217217
    218218                $user_login = sanitize_user( $_POST['user_login'] );
     
    295295        else
    296296                $redirect_to = $_REQUEST['redirect_to'];
    297297
    298         if ( $_POST ) {
     298        if ( $http_post ) {
    299299                $user_login = $_POST['log'];
    300300                $user_login = sanitize_user( $user_login );
    301301                $user_pass  = $_POST['pwd'];
     
    312312        do_action_ref_array('wp_authenticate', array(&$user_login, &$user_pass));
    313313
    314314        // If cookies are disabled we can't log in even with a valid user+pass
    315         if ( $_POST && empty($_COOKIE[TEST_COOKIE]) )
     315        if ( $http_post && empty($_COOKIE[TEST_COOKIE]) )
    316316                $errors['test_cookie'] = __('<strong>ERROR</strong>: WordPress requires Cookies but your browser does not support them or they are blocked.');
    317317
    318318        if ( $user_login && $user_pass && empty( $errors ) ) {
     
    334334                }
    335335        }
    336336
    337         if ( $_POST && empty( $user_login ) )
     337        if ( $http_post && empty( $user_login ) )
    338338                $errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.');
    339         if ( $_POST && empty( $user_pass ) )
     339        if ( $http_post && empty( $user_pass ) )
    340340                $errors['user_pass'] = __('<strong>ERROR</strong>: The password field is empty.');
    341341
    342342        // Some parts of this script use the main login form to display a message