1 | diff --git src/wp-admin/css/forms.css src/wp-admin/css/forms.css |
---|
2 | index 8e931a6..785f3ea 100644 |
---|
3 | --- src/wp-admin/css/forms.css |
---|
4 | +++ src/wp-admin/css/forms.css |
---|
5 | @@ -479,19 +479,19 @@ fieldset label, |
---|
6 | opacity: 1; |
---|
7 | } |
---|
8 | |
---|
9 | -#pass1.short { |
---|
10 | +#pass1.short, #pass1-text.short { |
---|
11 | border-color: #e35b5b; |
---|
12 | } |
---|
13 | |
---|
14 | -#pass1.bad { |
---|
15 | +#pass1.bad, #pass1-text.bad { |
---|
16 | border-color: #f78b53; |
---|
17 | } |
---|
18 | |
---|
19 | -#pass1.good { |
---|
20 | +#pass1.good, #pass1-text.good { |
---|
21 | border-color: #ffc733; |
---|
22 | } |
---|
23 | |
---|
24 | -#pass1.strong { |
---|
25 | +#pass1.strong, #pass1-text.strong { |
---|
26 | border-color: #83c373; |
---|
27 | } |
---|
28 | |
---|
29 | @@ -503,6 +503,20 @@ fieldset label, |
---|
30 | padding-top: 8px; |
---|
31 | } |
---|
32 | |
---|
33 | +#pass1-text, |
---|
34 | +.show-password #pass1 { |
---|
35 | + display: none; |
---|
36 | +} |
---|
37 | + |
---|
38 | +.show-password #pass1-text |
---|
39 | +{ |
---|
40 | + display: inline-block; |
---|
41 | +} |
---|
42 | + |
---|
43 | +.form-table span.description.important { |
---|
44 | + font-size: 12px; |
---|
45 | +} |
---|
46 | + |
---|
47 | p.search-box { |
---|
48 | float: right; |
---|
49 | margin: 0; |
---|
50 | diff --git src/wp-admin/css/install.css src/wp-admin/css/install.css |
---|
51 | index 149f7c4..a9f4991 100644 |
---|
52 | --- src/wp-admin/css/install.css |
---|
53 | +++ src/wp-admin/css/install.css |
---|
54 | @@ -205,13 +205,14 @@ submit { |
---|
55 | background-color: #eee; |
---|
56 | border: 1px solid #ddd; |
---|
57 | color: #23282d; |
---|
58 | + margin: -2px 5px 5px 0px; |
---|
59 | + padding: 3px 5px; |
---|
60 | + text-align: center; |
---|
61 | + width: 218px; |
---|
62 | -webkit-box-sizing: border-box; |
---|
63 | -moz-box-sizing: border-box; |
---|
64 | box-sizing: border-box; |
---|
65 | opacity: 0; |
---|
66 | - padding: 3px 5px; |
---|
67 | - text-align: center; |
---|
68 | - width: 218px; |
---|
69 | } |
---|
70 | |
---|
71 | #pass-strength-result.short { |
---|
72 | @@ -238,19 +239,19 @@ submit { |
---|
73 | opacity: 1; |
---|
74 | } |
---|
75 | |
---|
76 | -[name="admin_password"].short { |
---|
77 | +#pass1.short, #pass1-text.short { |
---|
78 | border-color: #e35b5b; |
---|
79 | } |
---|
80 | |
---|
81 | -[name="admin_password"].bad { |
---|
82 | +#pass1.bad, #pass1-text.bad { |
---|
83 | border-color: #f78b53; |
---|
84 | } |
---|
85 | |
---|
86 | -[name="admin_password"].good { |
---|
87 | +#pass1.good, #pass1-text.good { |
---|
88 | border-color: #ffc733; |
---|
89 | } |
---|
90 | |
---|
91 | -[name="admin_password"].strong { |
---|
92 | +#pass1.strong, #pass1-text.strong { |
---|
93 | border-color: #83c373; |
---|
94 | } |
---|
95 | |
---|
96 | @@ -278,6 +279,20 @@ submit { |
---|
97 | direction: ltr; |
---|
98 | } |
---|
99 | |
---|
100 | +#pass1-text, |
---|
101 | +.show-password #pass1 { |
---|
102 | + display: none; |
---|
103 | +} |
---|
104 | + |
---|
105 | +.show-password #pass1-text |
---|
106 | +{ |
---|
107 | + display: inline-block; |
---|
108 | +} |
---|
109 | + |
---|
110 | +.form-table span.description.important { |
---|
111 | + font-size: 12px; |
---|
112 | +} |
---|
113 | + |
---|
114 | |
---|
115 | /* localization */ |
---|
116 | body.rtl, |
---|
117 | diff --git src/wp-admin/install.php src/wp-admin/install.php |
---|
118 | index aef4c26..0f25ef3 100644 |
---|
119 | --- src/wp-admin/install.php |
---|
120 | +++ src/wp-admin/install.php |
---|
121 | @@ -137,17 +137,17 @@ function display_setup_form( $error = null ) { |
---|
122 | </label> |
---|
123 | </th> |
---|
124 | <td> |
---|
125 | - <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button> |
---|
126 | - <div class="wp-pwd hide-if-js"> |
---|
127 | + <div class=""> |
---|
128 | <?php $initial_password = wp_generate_password( 24 ); ?> |
---|
129 | <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" /> |
---|
130 | <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' ); ?>"> |
---|
131 | <span class="dashicons dashicons-visibility"></span> |
---|
132 | <span class="text"><?php _e( 'Hide' ); ?></span> |
---|
133 | </button> |
---|
134 | <div id="pass-strength-result" aria-live="polite"></div> |
---|
135 | </div> |
---|
136 | - <p><span class="description hide-if-no-js"><?php _e( 'A password reset link will be sent to you via email.' ); ?></span></p> |
---|
137 | + <p><span class="description important hide-if-no-js"> |
---|
138 | + <strong><?php _e( 'Important:' )?></strong> <?php _e( 'You will need this password to log in, please store it in a secure location.' ); ?></span></p> |
---|
139 | </td> |
---|
140 | </tr> |
---|
141 | <tr class="form-field form-required user-pass2-wrap hide-if-js"> |
---|
142 | diff --git src/wp-admin/js/user-profile.js src/wp-admin/js/user-profile.js |
---|
143 | index 71ac46d..e00d92e 100644 |
---|
144 | --- src/wp-admin/js/user-profile.js |
---|
145 | +++ src/wp-admin/js/user-profile.js |
---|
146 | @@ -1,4 +1,4 @@ |
---|
147 | -/* global ajaxurl, pwsL10n, userProfileL10n */ |
---|
148 | +/* global ajaxurl, pwsL10n */ |
---|
149 | (function($){ |
---|
150 | $(function(){ |
---|
151 | var pw_new = $('.user-pass1-wrap'), |
---|
152 | @@ -13,17 +13,37 @@ |
---|
153 | pw_submitbtn_edit = $('#submit'), |
---|
154 | pw_submitbtn_new = $( '#createusersub' ), |
---|
155 | pw_checkbox = $('.pw-checkbox'), |
---|
156 | - pw_weak = $('.pw-weak') |
---|
157 | - ; |
---|
158 | + pw_weak = $('.pw-weak'), |
---|
159 | + // Set up a text version of the password input |
---|
160 | + newField = document.createElement( 'input'); |
---|
161 | + newField.type = 'text'; |
---|
162 | + |
---|
163 | + var pwFieldText = $( newField ); |
---|
164 | + |
---|
165 | + if ( pw_field.length > 0 ) { |
---|
166 | + pwFieldText |
---|
167 | + .attr( { |
---|
168 | + 'id': 'pass1-text', |
---|
169 | + 'name': 'pass1-text', |
---|
170 | + 'autocomplete': 'off' |
---|
171 | + } ) |
---|
172 | + .addClass( pw_field[0].className ) |
---|
173 | + .data( 'pw', pw_field.data( 'pw' ) ) |
---|
174 | + .val( pw_field.val() ); |
---|
175 | + |
---|
176 | + pw_field |
---|
177 | + .wrap( '<span class="password-input-wrapper"></span>' ) |
---|
178 | + .after( pwFieldText ); |
---|
179 | + } |
---|
180 | |
---|
181 | + var pwWrapper = pw_field.parent(); |
---|
182 | var generatePassword = window.generatePassword = function() { |
---|
183 | if ( typeof zxcvbn !== 'function' ) { |
---|
184 | setTimeout( generatePassword, 50 ); |
---|
185 | } else { |
---|
186 | pw_field.val( pw_field.data( 'pw' ) ); |
---|
187 | pw_field.trigger( 'propertychange' ); |
---|
188 | - pw_field.attr( 'type', 'text' ).focus(); |
---|
189 | - pw_field[0].setSelectionRange(100, 100); |
---|
190 | + pwWrapper.addClass( 'show-password' ); |
---|
191 | } |
---|
192 | }; |
---|
193 | |
---|
194 | @@ -31,23 +51,28 @@ |
---|
195 | pw_line.hide(); |
---|
196 | pw_togglebtn.show(); |
---|
197 | pw_generatebtn.show(); |
---|
198 | - |
---|
199 | if ( pw_field.data( 'reveal' ) == 1 ) { |
---|
200 | generatePassword(); |
---|
201 | } |
---|
202 | |
---|
203 | parentform.on('submit', function(){ |
---|
204 | pw_field2.val( pw_field.val() ); |
---|
205 | - pw_field.attr('type', 'password'); |
---|
206 | + pwWrapper.removeClass( 'show-password' ); |
---|
207 | }); |
---|
208 | |
---|
209 | + pwFieldText.on( 'input', function(){ |
---|
210 | + pw_field.val( pwFieldText.val() ); |
---|
211 | + pw_field.trigger( 'propertychange' ); |
---|
212 | + } ); |
---|
213 | + |
---|
214 | |
---|
215 | pw_field.on('input propertychange', function(){ |
---|
216 | setTimeout( function(){ |
---|
217 | var cssClass = pw_strength.attr('class'); |
---|
218 | - pw_field.removeClass( 'short bad good strong' ); |
---|
219 | + pwFieldText.val( pw_field.val() ); |
---|
220 | + pw_field.add(pwFieldText).removeClass( 'short bad good strong' ); |
---|
221 | if ( 'undefined' !== typeof cssClass ) { |
---|
222 | - pw_field.addClass( cssClass ); |
---|
223 | + pw_field.add(pwFieldText).addClass( cssClass ); |
---|
224 | if ( cssClass == 'short' || cssClass == 'bad' ) { |
---|
225 | if ( ! pw_checkbox.attr( 'checked' ) ) { |
---|
226 | pw_submitbtn_new.attr( 'disabled','disabled' ); |
---|
227 | @@ -88,23 +113,37 @@ |
---|
228 | pw_generatebtn.hide(); |
---|
229 | pw_line.show(); |
---|
230 | generatePassword(); |
---|
231 | + _.defer( function() { |
---|
232 | + pwFieldText.focus(); |
---|
233 | + if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) { |
---|
234 | + pwFieldText[0].setSelectionRange( 0, 100 ); |
---|
235 | + } |
---|
236 | + }, 0 ); |
---|
237 | + |
---|
238 | }); |
---|
239 | |
---|
240 | + |
---|
241 | pw_togglebtn.on( 'click', function() { |
---|
242 | var show = pw_togglebtn.attr( 'data-toggle' ); |
---|
243 | if ( show == 1 ) { |
---|
244 | - pw_field.attr( 'type', 'text' ); |
---|
245 | + pwWrapper.addClass( 'show-password' ); |
---|
246 | pw_togglebtn.attr({ 'data-toggle': 0, 'aria-label': userProfileL10n.ariaHide }) |
---|
247 | .find( '.text' ).text( userProfileL10n.hide ) |
---|
248 | ; |
---|
249 | + pwFieldText.focus(); |
---|
250 | + if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) { |
---|
251 | + pwFieldText[0].setSelectionRange( 0, 100 ); |
---|
252 | + } |
---|
253 | } else { |
---|
254 | - pw_field.attr( 'type', 'password' ); |
---|
255 | + pwWrapper.removeClass( 'show-password' ); |
---|
256 | pw_togglebtn.attr({ 'data-toggle': 1, 'aria-label': userProfileL10n.ariaShow }) |
---|
257 | - .find( '.text' ).text( userProfileL10n.show ) |
---|
258 | - ; |
---|
259 | + .find( '.text' ).text( userProfileL10n.show ); |
---|
260 | + pw_field.focus(); |
---|
261 | + if ( ! _.isUndefined( pw_field[0].setSelectionRange ) ) { |
---|
262 | + pw_field[0].setSelectionRange( 0, 100 ); |
---|
263 | + } |
---|
264 | } |
---|
265 | - pw_field.focus(); |
---|
266 | - pw_field[0].setSelectionRange(100, 100); |
---|
267 | + |
---|
268 | }); |
---|
269 | }); |
---|
270 | |
---|