No Description

jetpack-sso-login.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435
  1. jQuery( document ).ready( function ( $ ) {
  2. var body = $( 'body' ),
  3. toggleSSO = $( '.jetpack-sso-toggle' ),
  4. userLogin = $( '#user_login' ),
  5. userPassword = $( '#user_pass' ),
  6. ssoWrap = $( '#jetpack-sso-wrap' ),
  7. loginForm = $( '#loginform' ),
  8. overflow = $( '<div class="jetpack-sso-clear"></div>' );
  9. // The overflow div is a poor man's clearfloat. We reposition the remember me
  10. // checkbox and the submit button within that to clear the float on the
  11. // remember me checkbox. This is important since we're positioning the SSO
  12. // UI under the submit button.
  13. //
  14. // @TODO: Remove this approach once core ticket 28528 is in and we have more actions in wp-login.php.
  15. // See - https://core.trac.wordpress.org/ticket/28528
  16. loginForm.append( overflow );
  17. overflow.append( $( 'p.forgetmenot' ), $( 'p.submit' ) );
  18. // We reposition the SSO UI at the bottom of the login form which
  19. // fixes a tab order issue. Then we override any styles for absolute
  20. // positioning of the SSO UI.
  21. loginForm.append( ssoWrap );
  22. body.addClass( 'jetpack-sso-repositioned' );
  23. toggleSSO.on( 'click', function ( e ) {
  24. e.preventDefault();
  25. body.toggleClass( 'jetpack-sso-form-display' );
  26. if ( ! body.hasClass( 'jetpack-sso-form-display' ) ) {
  27. userLogin.focus();
  28. userPassword.prop( 'disabled', false );
  29. }
  30. } );
  31. } );