diff --git src/wp-admin/css/forms.css src/wp-admin/css/forms.css
index 8e931a6..785f3ea 100644
|
|
fieldset label, |
479 | 479 | opacity: 1; |
480 | 480 | } |
481 | 481 | |
482 | | #pass1.short { |
| 482 | #pass1.short, #pass1-text.short { |
483 | 483 | border-color: #e35b5b; |
484 | 484 | } |
485 | 485 | |
486 | | #pass1.bad { |
| 486 | #pass1.bad, #pass1-text.bad { |
487 | 487 | border-color: #f78b53; |
488 | 488 | } |
489 | 489 | |
490 | | #pass1.good { |
| 490 | #pass1.good, #pass1-text.good { |
491 | 491 | border-color: #ffc733; |
492 | 492 | } |
493 | 493 | |
494 | | #pass1.strong { |
| 494 | #pass1.strong, #pass1-text.strong { |
495 | 495 | border-color: #83c373; |
496 | 496 | } |
497 | 497 | |
… |
… |
fieldset label, |
503 | 503 | padding-top: 8px; |
504 | 504 | } |
505 | 505 | |
| 506 | #pass1-text, |
| 507 | .show-password #pass1 { |
| 508 | display: none; |
| 509 | } |
| 510 | |
| 511 | .show-password #pass1-text |
| 512 | { |
| 513 | display: inline-block; |
| 514 | } |
| 515 | |
| 516 | .form-table span.description.important { |
| 517 | font-size: 12px; |
| 518 | } |
| 519 | |
506 | 520 | p.search-box { |
507 | 521 | float: right; |
508 | 522 | margin: 0; |
diff --git src/wp-admin/css/install.css src/wp-admin/css/install.css
index 149f7c4..a9f4991 100644
|
|
submit { |
205 | 205 | background-color: #eee; |
206 | 206 | border: 1px solid #ddd; |
207 | 207 | color: #23282d; |
| 208 | margin: -2px 5px 5px 0px; |
| 209 | padding: 3px 5px; |
| 210 | text-align: center; |
| 211 | width: 218px; |
208 | 212 | -webkit-box-sizing: border-box; |
209 | 213 | -moz-box-sizing: border-box; |
210 | 214 | box-sizing: border-box; |
211 | 215 | opacity: 0; |
212 | | padding: 3px 5px; |
213 | | text-align: center; |
214 | | width: 218px; |
215 | 216 | } |
216 | 217 | |
217 | 218 | #pass-strength-result.short { |
… |
… |
submit { |
238 | 239 | opacity: 1; |
239 | 240 | } |
240 | 241 | |
241 | | [name="admin_password"].short { |
| 242 | #pass1.short, #pass1-text.short { |
242 | 243 | border-color: #e35b5b; |
243 | 244 | } |
244 | 245 | |
245 | | [name="admin_password"].bad { |
| 246 | #pass1.bad, #pass1-text.bad { |
246 | 247 | border-color: #f78b53; |
247 | 248 | } |
248 | 249 | |
249 | | [name="admin_password"].good { |
| 250 | #pass1.good, #pass1-text.good { |
250 | 251 | border-color: #ffc733; |
251 | 252 | } |
252 | 253 | |
253 | | [name="admin_password"].strong { |
| 254 | #pass1.strong, #pass1-text.strong { |
254 | 255 | border-color: #83c373; |
255 | 256 | } |
256 | 257 | |
… |
… |
submit { |
278 | 279 | direction: ltr; |
279 | 280 | } |
280 | 281 | |
| 282 | #pass1-text, |
| 283 | .show-password #pass1 { |
| 284 | display: none; |
| 285 | } |
| 286 | |
| 287 | .show-password #pass1-text |
| 288 | { |
| 289 | display: inline-block; |
| 290 | } |
| 291 | |
| 292 | .form-table span.description.important { |
| 293 | font-size: 12px; |
| 294 | } |
| 295 | |
281 | 296 | |
282 | 297 | /* localization */ |
283 | 298 | body.rtl, |
diff --git src/wp-admin/install.php src/wp-admin/install.php
index aef4c26..0f25ef3 100644
|
|
function display_setup_form( $error = null ) { |
137 | 137 | </label> |
138 | 138 | </th> |
139 | 139 | <td> |
140 | | <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button> |
141 | | <div class="wp-pwd hide-if-js"> |
| 140 | <div class=""> |
142 | 141 | <?php $initial_password = wp_generate_password( 24 ); ?> |
143 | | <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> |
144 | | <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' ); ?>"> |
| 142 | <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" /> |
| 143 | <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0"> |
145 | 144 | <span class="dashicons dashicons-visibility"></span> |
146 | 145 | <span class="text"><?php _e( 'Hide' ); ?></span> |
147 | 146 | </button> |
148 | | <div id="pass-strength-result" aria-live="polite"></div> |
| 147 | <div id="pass-strength-result"></div> |
149 | 148 | </div> |
150 | | <p><span class="description hide-if-no-js"><?php _e( 'A password reset link will be sent to you via email.' ); ?></span></p> |
| 149 | <p><span class="description important hide-if-no-js"> |
| 150 | <strong><?php _e( 'Important:' )?></strong> <?php _e( 'You will need this password to log in, please store it in a secure location.' ); ?></span></p> |
151 | 151 | </td> |
152 | 152 | </tr> |
153 | 153 | <tr class="form-field form-required user-pass2-wrap hide-if-js"> |
diff --git src/wp-admin/js/user-profile.js src/wp-admin/js/user-profile.js
index 71ac46d..e00d92e 100644
|
|
|
1 | | /* global ajaxurl, pwsL10n, userProfileL10n */ |
| 1 | /* global ajaxurl, pwsL10n */ |
2 | 2 | (function($){ |
3 | 3 | $(function(){ |
4 | 4 | var pw_new = $('.user-pass1-wrap'), |
… |
… |
|
13 | 13 | pw_submitbtn_edit = $('#submit'), |
14 | 14 | pw_submitbtn_new = $( '#createusersub' ), |
15 | 15 | pw_checkbox = $('.pw-checkbox'), |
16 | | pw_weak = $('.pw-weak') |
17 | | ; |
| 16 | pw_weak = $('.pw-weak'), |
| 17 | // Set up a text version of the password input |
| 18 | newField = document.createElement( 'input'); |
| 19 | newField.type = 'text'; |
| 20 | |
| 21 | var pwFieldText = $( newField ); |
| 22 | |
| 23 | if ( pw_field.length > 0 ) { |
| 24 | pwFieldText |
| 25 | .attr( { |
| 26 | 'id': 'pass1-text', |
| 27 | 'name': 'pass1-text', |
| 28 | 'autocomplete': 'off' |
| 29 | } ) |
| 30 | .addClass( pw_field[0].className ) |
| 31 | .data( 'pw', pw_field.data( 'pw' ) ) |
| 32 | .val( pw_field.val() ); |
| 33 | |
| 34 | pw_field |
| 35 | .wrap( '<span class="password-input-wrapper"></span>' ) |
| 36 | .after( pwFieldText ); |
| 37 | } |
18 | 38 | |
| 39 | var pwWrapper = pw_field.parent(); |
19 | 40 | var generatePassword = window.generatePassword = function() { |
20 | 41 | if ( typeof zxcvbn !== 'function' ) { |
21 | 42 | setTimeout( generatePassword, 50 ); |
22 | 43 | } else { |
23 | 44 | pw_field.val( pw_field.data( 'pw' ) ); |
24 | 45 | pw_field.trigger( 'propertychange' ); |
25 | | pw_field.attr( 'type', 'text' ).focus(); |
26 | | pw_field[0].setSelectionRange(100, 100); |
| 46 | pwWrapper.addClass( 'show-password' ); |
27 | 47 | } |
28 | 48 | }; |
29 | 49 | |
… |
… |
|
31 | 51 | pw_line.hide(); |
32 | 52 | pw_togglebtn.show(); |
33 | 53 | pw_generatebtn.show(); |
34 | | |
35 | 54 | if ( pw_field.data( 'reveal' ) == 1 ) { |
36 | 55 | generatePassword(); |
37 | 56 | } |
38 | 57 | |
39 | 58 | parentform.on('submit', function(){ |
40 | 59 | pw_field2.val( pw_field.val() ); |
41 | | pw_field.attr('type', 'password'); |
| 60 | pwWrapper.removeClass( 'show-password' ); |
42 | 61 | }); |
43 | 62 | |
| 63 | pwFieldText.on( 'input', function(){ |
| 64 | pw_field.val( pwFieldText.val() ); |
| 65 | pw_field.trigger( 'propertychange' ); |
| 66 | } ); |
| 67 | |
44 | 68 | |
45 | 69 | pw_field.on('input propertychange', function(){ |
46 | 70 | setTimeout( function(){ |
47 | 71 | var cssClass = pw_strength.attr('class'); |
48 | | pw_field.removeClass( 'short bad good strong' ); |
| 72 | pwFieldText.val( pw_field.val() ); |
| 73 | pw_field.add(pwFieldText).removeClass( 'short bad good strong' ); |
49 | 74 | if ( 'undefined' !== typeof cssClass ) { |
50 | | pw_field.addClass( cssClass ); |
| 75 | pw_field.add(pwFieldText).addClass( cssClass ); |
51 | 76 | if ( cssClass == 'short' || cssClass == 'bad' ) { |
52 | 77 | if ( ! pw_checkbox.attr( 'checked' ) ) { |
53 | 78 | pw_submitbtn_new.attr( 'disabled','disabled' ); |
… |
… |
|
88 | 113 | pw_generatebtn.hide(); |
89 | 114 | pw_line.show(); |
90 | 115 | generatePassword(); |
| 116 | _.defer( function() { |
| 117 | pwFieldText.focus(); |
| 118 | if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) { |
| 119 | pwFieldText[0].setSelectionRange( 0, 100 ); |
| 120 | } |
| 121 | }, 0 ); |
| 122 | |
91 | 123 | }); |
92 | 124 | |
| 125 | |
93 | 126 | pw_togglebtn.on( 'click', function() { |
94 | 127 | var show = pw_togglebtn.attr( 'data-toggle' ); |
95 | 128 | if ( show == 1 ) { |
96 | | pw_field.attr( 'type', 'text' ); |
| 129 | pwWrapper.addClass( 'show-password' ); |
97 | 130 | pw_togglebtn.attr({ 'data-toggle': 0, 'aria-label': userProfileL10n.ariaHide }) |
98 | 131 | .find( '.text' ).text( userProfileL10n.hide ) |
99 | 132 | ; |
| 133 | pwFieldText.focus(); |
| 134 | if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) { |
| 135 | pwFieldText[0].setSelectionRange( 0, 100 ); |
| 136 | } |
100 | 137 | } else { |
101 | | pw_field.attr( 'type', 'password' ); |
| 138 | pwWrapper.removeClass( 'show-password' ); |
102 | 139 | pw_togglebtn.attr({ 'data-toggle': 1, 'aria-label': userProfileL10n.ariaShow }) |
103 | | .find( '.text' ).text( userProfileL10n.show ) |
104 | | ; |
| 140 | .find( '.text' ).text( userProfileL10n.show ); |
| 141 | pw_field.focus(); |
| 142 | if ( ! _.isUndefined( pw_field[0].setSelectionRange ) ) { |
| 143 | pw_field[0].setSelectionRange( 0, 100 ); |
| 144 | } |
105 | 145 | } |
106 | | pw_field.focus(); |
107 | | pw_field[0].setSelectionRange(100, 100); |
| 146 | |
108 | 147 | }); |
109 | 148 | }); |
110 | 149 | |