diff --git src/wp-admin/css/login.css src/wp-admin/css/login.css
index d5c60f117a..0f4f9f84b0 100644
|
|
input::-ms-reveal { |
385 | 385 | margin: -0.1875rem 0 0 -0.25rem; |
386 | 386 | } |
387 | 387 | } |
| 388 | |
| 389 | .shake { |
| 390 | animation: shake 0.2s cubic-bezier(.19,.49,.38,.79) both; |
| 391 | animation-iteration-count: 3; |
| 392 | transform: translateX(0); |
| 393 | } |
| 394 | |
| 395 | @keyframes shake { |
| 396 | 25% { |
| 397 | transform: translateX(-20px); |
| 398 | } |
| 399 | 75% { |
| 400 | transform: translateX(20px); |
| 401 | } |
| 402 | 100% { |
| 403 | transform: translateX(0); |
| 404 | } |
| 405 | } |
diff --git src/wp-login.php src/wp-login.php
index db739eddad..f404736e34 100644
|
|
function login_header( $title = 'Log In', $message = '', $wp_error = null ) { |
62 | 62 | $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes ); |
63 | 63 | |
64 | 64 | if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes, true ) ) { |
65 | | add_action( 'login_head', 'wp_shake_js', 12 ); |
| 65 | add_action( 'login_footer', 'wp_shake_js', 12 ); |
66 | 66 | } |
67 | 67 | |
68 | 68 | $login_title = get_bloginfo( 'name', 'display' ); |
… |
… |
function login_footer( $input_id = '' ) { |
335 | 335 | function wp_shake_js() { |
336 | 336 | ?> |
337 | 337 | <script type="text/javascript"> |
338 | | addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; |
339 | | function s(id,pos){g(id).left=pos+'px';} |
340 | | function g(id){return document.getElementById(id).style;} |
341 | | function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}} |
342 | | addLoadEvent(function(){ var p=new Array(15,30,15,0,-15,-30,-15,0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i,p,20);}); |
| 338 | document.querySelector('form').classList.add('shake'); |
343 | 339 | </script> |
344 | 340 | <?php |
345 | 341 | } |