Ticket #42888: 42888.7.diff
File 42888.7.diff, 18.2 KB (added by , 5 years ago) |
---|
-
src/js/_enqueues/admin/user-profile.js
7 7 var updateLock = false, 8 8 9 9 $pass1Row, 10 $pass1Wrap,11 10 $pass1, 12 $pass1Text,13 $pass1Label,14 11 $pass2, 15 12 $weakRow, 16 13 $weakCheckbox, … … 36 33 } 37 34 38 35 if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) { 39 $pass1 Wrap.addClass( 'show-password' );36 $pass1.attr( 'type', 'text' ); 40 37 } else { 41 38 $toggleButton.trigger( 'click' ); 42 39 } … … 48 45 function bindPass1() { 49 46 currentPass = $pass1.val(); 50 47 51 $pass1Wrap = $pass1.parent();52 53 $pass1Text = $( '<input type="text"/>' )54 .attr( {55 'id': 'pass1-text',56 'name': 'pass1-text',57 'autocomplete': 'off'58 } )59 .addClass( $pass1[0].className )60 .data( 'pw', $pass1.data( 'pw' ) )61 .val( $pass1.val() )62 .on( 'input', function () {63 if ( $pass1Text.val() === currentPass ) {64 return;65 }66 $pass2.val( $pass1Text.val() );67 $pass1.val( $pass1Text.val() ).trigger( 'pwupdate' );68 currentPass = $pass1Text.val();69 } );70 71 $pass1.after( $pass1Text );72 73 48 if ( 1 === parseInt( $pass1.data( 'reveal' ), 10 ) ) { 74 49 generatePassword(); 75 50 } … … 80 55 } 81 56 82 57 currentPass = $pass1.val(); 83 if ( $pass1Text.val() !== currentPass ) { 84 $pass1Text.val( currentPass ); 85 } 86 $pass1.add( $pass1Text ).removeClass( 'short bad good strong' ); 58 59 $pass1.removeClass( 'short bad good strong' ); 87 60 showOrHideWeakPasswordCheckbox(); 88 61 } ); 89 62 } 90 63 91 function resetToggle( ) {64 function resetToggle( show ) { 92 65 $toggleButton 93 .data( 'toggle', 0 )94 66 .attr({ 95 'aria-label': userProfileL10n.ariaHide67 'aria-label': show ? userProfileL10n.ariaShow : userProfileL10n.ariaHide 96 68 }) 97 69 .find( '.text' ) 98 .text( userProfileL10n.hide )70 .text( show ? userProfileL10n.show : userProfileL10n.hide ) 99 71 .end() 100 72 .find( '.dashicons' ) 101 .removeClass( 'dashicons-visibility' ) 102 .addClass( 'dashicons-hidden' ); 103 104 $pass1Text.focus(); 105 106 $pass1Label.attr( 'for', 'pass1-text' ); 73 .removeClass( show ? 'dashicons-hidden' : 'dashicons-visibility' ) 74 .addClass( show ? 'dashicons-visibility' : 'dashicons-hidden' ); 107 75 } 108 76 109 77 function bindToggleButton() { 110 78 $toggleButton = $pass1Row.find('.wp-hide-pw'); 111 79 $toggleButton.show().on( 'click', function () { 112 if ( 1 === parseInt( $toggleButton.data( 'toggle' ), 10 ) ) { 113 $pass1Wrap.addClass( 'show-password' ); 114 115 resetToggle(); 116 117 if ( ! _.isUndefined( $pass1Text[0].setSelectionRange ) ) { 118 $pass1Text[0].setSelectionRange( 0, 100 ); 119 } 80 if ( 'password' === $pass1.attr( 'type' ) ) { 81 $pass1.attr( 'type', 'text' ); 82 resetToggle( false ); 120 83 } else { 121 $pass1Wrap.removeClass( 'show-password' ); 122 $toggleButton 123 .data( 'toggle', 1 ) 124 .attr({ 125 'aria-label': userProfileL10n.ariaShow 126 }) 127 .find( '.text' ) 128 .text( userProfileL10n.show ) 129 .end() 130 .find( '.dashicons' ) 131 .removeClass('dashicons-hidden') 132 .addClass('dashicons-visibility'); 84 $pass1.attr( 'type', 'password' ); 85 resetToggle( true ); 86 } 133 87 134 88 $pass1.focus(); 135 89 136 $pass1Label.attr( 'for', 'pass1' ); 137 138 if ( ! _.isUndefined( $pass1[0].setSelectionRange ) ) { 139 $pass1[0].setSelectionRange( 0, 100 ); 140 } 90 if ( ! _.isUndefined( $pass1[0].setSelectionRange ) ) { 91 $pass1[0].setSelectionRange( 0, 100 ); 141 92 } 142 93 }); 143 94 } … … 147 98 $generateButton, 148 99 $cancelButton; 149 100 150 $pass1Row = $('.user-pass1-wrap'); 151 $pass1Label = $pass1Row.find('th label').attr( 'for', 'pass1-text' ); 101 $pass1Row = $( '.user-pass1-wrap, .user-pass-wrap' ); 152 102 153 // hide this103 // Hide the confirm password field when JavaScript support is enabled. 154 104 $('.user-pass2-wrap').hide(); 155 105 156 106 $submitButton = $( '#submit, #wp-submit' ).on( 'click', function () { … … 168 118 $pass1 = $('#pass1'); 169 119 if ( $pass1.length ) { 170 120 bindPass1(); 121 } else { 122 // Password field for the login form. 123 $pass1 = $( '#user_pass' ); 171 124 } 172 125 173 126 /** … … 189 142 if ( $pass1.is( ':hidden' ) ) { 190 143 $pass1.prop( 'disabled', true ); 191 144 $pass2.prop( 'disabled', true ); 192 $pass1Text.prop( 'disabled', true );193 145 } 194 146 195 147 $passwordWrapper = $pass1Row.find( '.wp-pwd' ); … … 211 163 // Enable the inputs when showing. 212 164 $pass1.attr( 'disabled', false ); 213 165 $pass2.attr( 'disabled', false ); 214 $pass1Text.attr( 'disabled', false );215 166 216 if ( $pass1 Text.val().length === 0 ) {167 if ( $pass1.val().length === 0 ) { 217 168 generatePassword(); 218 169 } 219 220 _.defer( function() {221 $pass1Text.focus();222 if ( ! _.isUndefined( $pass1Text[0].setSelectionRange ) ) {223 $pass1Text[0].setSelectionRange( 0, 100 );224 }225 }, 0 );226 170 } ); 227 171 228 172 $cancelButton = $pass1Row.find( 'button.wp-cancel-pw' ); … … 230 174 updateLock = false; 231 175 232 176 // Clear any entered password. 233 $pass1 Text.val( '' );177 $pass1.val( '' ); 234 178 235 179 // Generate a new password. 236 180 wp.ajax.post( 'generate-password' ) … … 248 192 // Disable the inputs when hiding to prevent autofill and submission. 249 193 $pass1.prop( 'disabled', true ); 250 194 $pass2.prop( 'disabled', true ); 251 $pass1Text.prop( 'disabled', true );252 195 253 resetToggle( );196 resetToggle( false ); 254 197 255 198 if ( $pass1Row.closest( 'form' ).is( '#your-profile' ) ) { 256 199 // Clear password field to prevent update … … 265 208 $pass1.prop( 'disabled', false ); 266 209 $pass2.prop( 'disabled', false ); 267 210 $pass2.val( $pass1.val() ); 268 $pass1Wrap.removeClass( 'show-password' );269 211 }); 270 212 } 271 213 … … 305 247 var passStrength = $('#pass-strength-result')[0]; 306 248 307 249 if ( passStrength.className ) { 308 $pass1.add ( $pass1Text ).addClass( passStrength.className );250 $pass1.addClass( passStrength.className ); 309 251 if ( $( passStrength ).is( '.short, .bad' ) ) { 310 252 if ( ! $weakCheckbox.prop( 'checked' ) ) { 311 253 $submitButtons.prop( 'disabled', true ); -
src/wp-admin/css/forms.css
1500 1500 position: relative; 1501 1501 } 1502 1502 1503 .wp-pwd [type="text"],1504 .wp-pwd [type="password"]{1505 padding-right: 88px;1503 /* Needs higher specificity than normal input type text and password. */ 1504 #profile-page .form-table #pass1 { 1505 padding-right: 90px; 1506 1506 } 1507 1507 1508 1508 .wp-pwd button.button { -
src/wp-admin/css/install.css
301 301 box-sizing: border-box; 302 302 } 303 303 304 .wp-pwd #pass1 { 305 padding-right: 50px; 306 } 307 308 .wp-pwd .button.wp-hide-pw { 309 right: 0; 310 } 311 312 #pass-strength-result { 313 width: 100%; 314 } 304 315 } 305 316 306 317 body.language-chooser { -
src/wp-admin/css/login.css
37 37 0 0 2px 1px rgba(30, 140, 190, 0.8); 38 38 } 39 39 40 .ie8 a:focus {41 outline: #5b9dd9 solid 1px;42 }43 44 40 p { 45 41 line-height: 1.5; 46 42 } … … 75 71 padding: 0; 76 72 } 77 73 78 .login .password-input-wrapper {79 position: relative;80 }81 82 .login .input.password-input {83 margin: 0;84 }85 86 74 .login .input::-ms-clear { 87 75 display: none; 88 76 } … … 91 79 margin-bottom: 15px; 92 80 } 93 81 94 .login .button. button-secondary{82 .login .button.wp-hide-pw { 95 83 background: transparent; 96 84 border: 1px solid transparent; 97 85 box-shadow: none; … … 102 90 padding: 5px 9px; 103 91 position: absolute; 104 92 right: 0; 105 top: 0;93 top: 3px; 106 94 } 107 95 108 .login .button. button-secondary:hover {96 .login .button.wp-hide-pw:hover { 109 97 background: transparent; 110 98 } 111 99 112 .login .button. button-secondary:focus {100 .login .button.wp-hide-pw:focus { 113 101 background: transparent; 114 102 border-color: #5b9dd9; 115 103 box-shadow: 0 0 3px rgba(0, 115, 170, 0.8); 116 104 } 117 105 118 .login .button. button-secondary:active {106 .login .button.wp-hide-pw:active { 119 107 background: transparent; 120 108 box-shadow: none; 121 109 transform: none; 122 110 } 123 111 112 .login .button.wp-hide-pw .dashicons { 113 top: 4px; 114 } 115 116 .login .wp-pwd { 117 position: relative; 118 } 119 120 .no-js .hide-if-no-js { 121 display: none; 122 } 123 124 124 .login form { 125 125 margin-top: 20px; 126 126 margin-left: 0; … … 195 195 font-size: 14px; 196 196 } 197 197 198 .login form .forgetmenot label { 199 font-size: 12px; 200 line-height: 1.58333333; 198 .login .forgetmenot label, 199 .login .pw-weak label { 200 line-height: 1.5; 201 vertical-align: baseline; 201 202 } 202 203 203 204 .login h1 { … … 270 271 } 271 272 272 273 .login form .input, 273 .login input[type="text"] { 274 .login input[type="text"], 275 .login input[type="password"] { 274 276 font-size: 24px; 275 277 width: 100%; 276 278 padding: 5px; 277 margin: 2px 6px 16px 0;279 margin: 3px 6px 16px 0; 278 280 } 279 281 280 .login-action-rp form .input, 281 .login-action-rp input[type="text"] { 282 padding: 5px 45px 5px 5px; 282 .js.login input.password-input, 283 .js.login-action-rp form .input, 284 .js.login-action-rp input[type="text"] { 285 padding-right: 45px; 283 286 } 284 287 285 288 .login form .input, … … 288 291 background: #fbfbfb; 289 292 } 290 293 291 . ie7 .login form .input,292 . ie8 .login form .input{293 font-family: sans-serif;294 .js.login-action-rp input[type="text"], 295 .js.login-action-rp input[type="password"] { 296 margin-bottom: 0; 294 297 } 295 298 296 .login-action-rp input[type="text"] {297 box-shadow: none;298 margin: 0;299 }300 301 299 .login #pass-strength-result { 302 300 font-weight: 600; 303 301 margin: -1px 5px 16px 0; -
src/wp-login.php
825 825 ?> 826 826 827 827 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> 828 <p> 829 <label for="user_login" ><?php _e( 'Username or Email Address' ); ?><br /> 830 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /></label> 831 </p> 828 829 <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> 830 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /> 832 831 <?php 833 832 834 833 /** … … 840 839 841 840 ?> 842 841 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 843 < pclass="submit">842 <div class="submit"> 844 843 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Get New Password' ); ?>" /> 845 </ p>844 </div> 846 845 </form> 847 846 848 < pid="nav">847 <div id="nav"> 849 848 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 850 849 <?php 851 850 … … 859 858 } 860 859 861 860 ?> 862 </ p>861 </div> 863 862 <?php 864 863 865 864 login_footer( 'user_login' ); … … 936 935 <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" /> 937 936 938 937 <div class="user-pass1-wrap"> 939 <p>940 <label for="pass1"><?php _e( 'New password' ); ?></label>941 </p>942 938 939 <label for="pass1"><?php _e( 'New password' ); ?></label> 940 943 941 <div class="wp-pwd"> 944 <div class="password-input-wrapper"> 945 <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="off" aria-describedby="pass-strength-result" /> 946 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js"> 947 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> 948 </button> 949 </div> 942 <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="off" aria-describedby="pass-strength-result" /> 943 944 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> 945 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> 946 </button> 950 947 <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div> 951 948 </div> 952 949 <div class="pw-weak"> 953 <label> 954 <input type="checkbox" name="pw_weak" class="pw-checkbox" /> 955 <?php _e( 'Confirm use of weak password' ); ?> 956 </label> 950 <input type="checkbox" name="pw_weak" id="pw-weak" class="pw-checkbox" /> 951 <label for="pw-weak"><?php _e( 'Confirm use of weak password' ); ?></label> 957 952 </div> 958 953 </div> 959 954 960 < pclass="user-pass2-wrap">961 <label for="pass2"><?php _e( 'Confirm new password' ); ?></label> <br />955 <div class="user-pass2-wrap"> 956 <label for="pass2"><?php _e( 'Confirm new password' ); ?></label> 962 957 <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /> 963 </ p>958 </div> 964 959 965 960 <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p> 966 961 <br class="clear" /> … … 978 973 979 974 ?> 980 975 <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> 981 < pclass="submit">976 <div class="submit"> 982 977 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Reset Password' ); ?>" /> 983 </ p>978 </div> 984 979 </form> 985 980 986 < pid="nav">981 <div id="nav"> 987 982 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 988 983 <?php 989 984 … … 997 992 } 998 993 999 994 ?> 1000 </ p>995 </div> 1001 996 <?php 1002 997 1003 998 login_footer( 'user_pass' ); … … 1057 1052 1058 1053 ?> 1059 1054 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> 1060 < p>1061 <label for="user_login"><?php _e( 'Username' ); ?>< br />1062 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" /> </label>1063 </ p>1064 < p>1065 <label for="user_email"><?php _e( 'Email' ); ?>< br />1066 <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /> </label>1067 </ p>1055 <div> 1056 <label for="user_login"><?php _e( 'Username' ); ?></label> 1057 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" /> 1058 </div> 1059 <div> 1060 <label for="user_email"><?php _e( 'Email' ); ?></label> 1061 <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /> 1062 </div> 1068 1063 <?php 1069 1064 1070 1065 /** … … 1080 1075 </p> 1081 1076 <br class="clear" /> 1082 1077 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 1083 < pclass="submit">1078 <div class="submit"> 1084 1079 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" /> 1085 </ p>1080 </div> 1086 1081 </form> 1087 1082 1088 < pid="nav">1083 <div id="nav"> 1089 1084 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 1090 1085 <?php echo esc_html( $login_link_separator ); ?> 1091 1086 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> 1092 </ p>1087 </div> 1093 1088 <?php 1094 1089 1095 1090 login_footer( 'user_login' ); … … 1329 1324 $aria_describedby_error = ''; 1330 1325 } 1331 1326 1327 wp_enqueue_script( 'user-profile' ); 1332 1328 ?> 1333 1329 1334 1330 <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> 1335 <p> 1336 <label for="user_login"><?php _e( 'Username or Email Address' ); ?><br /> 1337 <input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /></label> 1338 </p> 1339 <p> 1340 <label for="user_pass"><?php _e( 'Password' ); ?><br /> 1341 <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input" value="" size="20" /></label> 1342 </p> 1331 <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> 1332 <input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /> 1333 1334 <div class="user-pass-wrap"> 1335 <label for="user_pass"><?php _e( 'Password' ); ?></label> 1336 <div class="wp-pwd"> 1337 <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input password-input" value="" size="20" /> 1338 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Show password' ); ?>"> 1339 <span class="dashicons dashicons-visibility" aria-hidden="true"></span> 1340 </button> 1341 </div> 1342 </div> 1343 1343 <?php 1344 1344 1345 1345 /** … … 1350 1350 do_action( 'login_form' ); 1351 1351 1352 1352 ?> 1353 < p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_html_e( 'Remember Me' ); ?></label></p>1354 < pclass="submit">1353 <div class="forgetmenot"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <label for="rememberme"><?php esc_html_e( 'Remember Me' ); ?></label></div> 1354 <div class="submit"> 1355 1355 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In' ); ?>" /> 1356 1356 <?php 1357 1357 … … 1373 1373 1374 1374 ?> 1375 1375 <input type="hidden" name="testcookie" value="1" /> 1376 </ p>1376 </div> 1377 1377 </form> 1378 1378 1379 1379 <?php … … 1380 1380 1381 1381 if ( ! $interim_login ) { 1382 1382 ?> 1383 < pid="nav">1383 <div id="nav"> 1384 1384 <?php 1385 1385 1386 1386 if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ), true ) ) { … … 1399 1399 } 1400 1400 1401 1401 ?> 1402 </ p>1402 </div> 1403 1403 <?php 1404 1404 } 1405 1405