WordPress.org

Make WordPress Core

Changeset 12815 for trunk/wp-login.php


Ignore:
Timestamp:
01/23/2010 11:07:56 PM (10 years ago)
Author:
markjaquith
Message:

seismic failures.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-login.php

    r12814 r12815  
    4646    add_action( 'login_head', 'noindex' );
    4747
     48    // Print scripts
     49    add_action( 'login_head', 'wp_print_scripts' );
     50
    4851    if ( empty($wp_error) )
    4952        $wp_error = new WP_Error();
     53
     54    // Shake it!
     55    $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
     56    $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
     57
     58    if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) {
     59        wp_enqueue_script( 'jquery-ui-effects' );
     60        add_action( 'login_head', 'wp_shake_js', 12 );
     61    }
     62
    5063    ?>
    5164<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    108121    }
    109122} // End of login_header()
     123
     124function wp_shake_js() {
     125?>
     126<script type="text/javascript">
     127jQuery( document ).ready(function(){
     128    jQuery( '#h1' ).focus();
     129    jQuery( '#loginform, #registerform, #lostpasswordform' ).effect('shake', {times: 3}, 40, function(){try{wp_attempt_focus();} catch(e){}});
     130});
     131</script>
     132<?php
     133}
    110134
    111135/**
     
    589613
    590614<script type="text/javascript">
     615function wp_attempt_focus(){
     616setTimeout( function(){ try{
    591617<?php if ( $user_login || $interim_login ) { ?>
    592 setTimeout( function(){ try{
    593618d = document.getElementById('user_pass');
     619<?php } else { ?>
     620d = document.getElementById('user_login'); 
     621<?php } ?>
    594622d.value = '';
    595623d.focus();
    596624} catch(e){}
    597625}, 200);
    598 <?php } else { ?>
    599 try{document.getElementById('user_login').focus();}catch(e){}
     626}
     627
     628<?php if ( !$error ) { ?>
     629wp_attempt_focus();
    600630<?php } ?>
    601631</script>
Note: See TracChangeset for help on using the changeset viewer.