Index: src/wp-admin/css/forms.css
===================================================================
--- src/wp-admin/css/forms.css (revision 33325)
+++ src/wp-admin/css/forms.css (working copy)
@@ -503,6 +503,18 @@
padding-top: 8px;
}
+#pass1-text,
+.show-password #pass1 {
+ display: none;
+}
+.show-password #pass1-text
+{
+ display: inline-block;
+}
+.form-table span.description.important {
+ font-size: 12px;
+}
+
p.search-box {
float: right;
margin: 0;
Index: src/wp-admin/css/install.css
===================================================================
--- src/wp-admin/css/install.css (revision 33325)
+++ src/wp-admin/css/install.css (working copy)
@@ -278,7 +278,21 @@
direction: ltr;
}
+#pass1-text,
+.show-password #pass1 {
+ display: none;
+}
+.show-password #pass1-text
+{
+ display: inline-block;
+}
+
+.form-table span.description.important {
+ font-size: 12px;
+}
+
+
/* localization */
body.rtl,
.rtl textarea,
Index: src/wp-admin/install.php
===================================================================
--- src/wp-admin/install.php (revision 33325)
+++ src/wp-admin/install.php (working copy)
@@ -137,10 +137,9 @@
-
- |
Index: src/wp-admin/js/user-profile.js
===================================================================
--- src/wp-admin/js/user-profile.js (revision 33325)
+++ src/wp-admin/js/user-profile.js (working copy)
@@ -1,4 +1,4 @@
-/* global ajaxurl, pwsL10n, userProfileL10n */
+/* global ajaxurl, pwsL10n */
(function($){
$(function(){
var pw_new = $('.user-pass1-wrap'),
@@ -13,9 +13,30 @@
pw_submitbtn_edit = $('#submit'),
pw_submitbtn_new = $( '#createusersub' ),
pw_checkbox = $('.pw-checkbox'),
- pw_weak = $('.pw-weak')
- ;
+ pw_weak = $('.pw-weak'),
+ // Set up a text version of the password input
+ newField = document.createElement( 'input');
+ newField.type = 'text';
+ var pwFieldText = $( newField );
+
+ if ( pw_field.length > 0 ) {
+ pwFieldText
+ .attr( {
+ 'id': 'pass1-text',
+ 'name': 'pass1-text',
+ 'autocomplete': 'off'
+ } )
+ .addClass( pw_field[0].className )
+ .data( 'pw', pw_field.data( 'pw' ) )
+ .val( pw_field.val() );
+
+ pw_field
+ .wrap( '' )
+ .after( pwFieldText );
+ }
+
+ var pwWrapper = pw_field.parent();
var generatePassword = window.generatePassword = function() {
if ( typeof zxcvbn !== 'function' ) {
setTimeout( generatePassword, 50 );
@@ -22,8 +43,7 @@
} else {
pw_field.val( pw_field.data( 'pw' ) );
pw_field.trigger( 'propertychange' );
- pw_field.attr( 'type', 'text' ).focus();
- pw_field[0].setSelectionRange(100, 100);
+ pwWrapper.addClass( 'show-password' );
}
};
@@ -31,20 +51,26 @@
pw_line.hide();
pw_togglebtn.show();
pw_generatebtn.show();
-
if ( pw_field.data( 'reveal' ) == 1 ) {
generatePassword();
- }
+}
+
parentform.on('submit', function(){
pw_field2.val( pw_field.val() );
- pw_field.attr('type', 'password');
+ pwWrapper.removeClass( 'show-password' );
});
+ pwFieldText.on( 'input', function(){
+ pw_field.val( pwFieldText.val() );
+ pw_field.trigger( 'propertychange' );
+ } );
+
pw_field.on('input propertychange', function(){
setTimeout( function(){
var cssClass = pw_strength.attr('class');
+ pwFieldText.val( pw_field.val() );
pw_field.removeClass( 'short bad good strong' );
if ( 'undefined' !== typeof cssClass ) {
pw_field.addClass( cssClass );
@@ -88,25 +114,38 @@
pw_generatebtn.hide();
pw_line.show();
generatePassword();
+ _.defer( function() {
+ pwFieldText.focus();
+ if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) {
+ pwFieldText[0].setSelectionRange( 0, 100 );
+ }
+ }, 0 );
+
});
pw_togglebtn.on( 'click', function() {
var show = pw_togglebtn.attr( 'data-toggle' );
if ( show == 1 ) {
- pw_field.attr( 'type', 'text' );
+ pwWrapper.addClass( 'show-password' );
pw_togglebtn.attr( 'data-toggle', 0 )
.find( '.text' )
- .text( userProfileL10n.hide )
+ .text( 'hide' )
;
+ pwFieldText.focus();
+ if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) {
+ pwFieldText[0].setSelectionRange( 0, 100 );
+ }
} else {
- pw_field.attr( 'type', 'password' );
+ pwWrapper.removeClass( 'show-password' );
pw_togglebtn.attr( 'data-toggle', 1 )
.find( '.text' )
- .text( userProfileL10n.show )
+ .text( 'show' )
;
+ pw_field.focus();
+ if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) {
+ pw_field[0].setSelectionRange( 0, 100 );
+ }
}
- pw_field.focus();
- pw_field[0].setSelectionRange(100, 100);
});
});