From 61dd2bfddeeb29bd85c7c4d785eb2b93dca844b7 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Wed, 29 Jul 2015 19:22:26 +0000 Subject: [PATCH] Persist (and mask) the password on the install screen if the install does not proceed due to errors. If you forget or enter an invalid username/e-mail, the password choosing shouldn't start over. fixes #33162 Built from https://develop.svn.wordpress.org/trunk@33495 git-svn-id: http://core.svn.wordpress.org/trunk@33462 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/install.php | 4 ++-- wp-admin/js/user-profile.js | 17 +++++++++++------ wp-admin/js/user-profile.min.js | 2 +- wp-includes/version.php | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/wp-admin/install.php b/wp-admin/install.php index 4eab6b303f..2c0c6071bf 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -137,9 +137,9 @@ function display_setup_form( $error = null ) {
- + - diff --git a/wp-admin/js/user-profile.js b/wp-admin/js/user-profile.js index 799ee97276..bb80a3274f 100644 --- a/wp-admin/js/user-profile.js +++ b/wp-admin/js/user-profile.js @@ -12,6 +12,7 @@ $weakRow, $weakCheckbox, + $toggleButton, $submitButtons, $submitButton, currentPass; @@ -22,7 +23,11 @@ } else { $pass1.val( $pass1.data( 'pw' ) ); $pass1.trigger( 'pwupdate' ); - $pass1Wrap.addClass( 'show-password' ); + if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) { + $pass1Wrap.addClass( 'show-password' ); + } else { + $toggleButton.trigger( 'click' ); + } } } @@ -82,11 +87,11 @@ } function bindToggleButton() { - var toggleButton = $pass1Row.find('.wp-hide-pw'); - toggleButton.show().on( 'click', function () { - if ( 1 === parseInt( toggleButton.data( 'toggle' ), 10 ) ) { + $toggleButton = $pass1Row.find('.wp-hide-pw'); + $toggleButton.show().on( 'click', function () { + if ( 1 === parseInt( $toggleButton.data( 'toggle' ), 10 ) ) { $pass1Wrap.addClass( 'show-password' ); - toggleButton + $toggleButton .data( 'toggle', 0 ) .attr({ 'aria-label': userProfileL10n.ariaHide @@ -105,7 +110,7 @@ } } else { $pass1Wrap.removeClass( 'show-password' ); - toggleButton + $toggleButton .data( 'toggle', 1 ) .attr({ 'aria-label': userProfileL10n.ariaShow diff --git a/wp-admin/js/user-profile.min.js b/wp-admin/js/user-profile.min.js index 27c35eb86a..37fda5fa1a 100644 --- a/wp-admin/js/user-profile.min.js +++ b/wp-admin/js/user-profile.min.js @@ -1 +1 @@ -!function(a){function b(){"function"!=typeof zxcvbn?setTimeout(b,50):(i.val(i.data("pw")),i.trigger("pwupdate"),h.addClass("show-password"))}function c(){var c=a("#pass-strength-result")[0];p=i.val(),h=i.parent(),j=a('').attr({id:"pass1-text",name:"pass1-text",autocomplete:"off"}).addClass(i[0].className).data("pw",i.data("pw")).val(i.val()).on("input propertychange",function(){j.val()!==p&&(k.val(j.val()),i.val(j.val()).trigger("pwupdate"),p=j.val())}),i.after(j),1===parseInt(i.data("reveal"),10)&&b(),i.on("input propertychange pwupdate",function(){i.val()!==p&&(p=i.val(),j.val(p),i.add(j).removeClass("short bad good strong"),c.className&&(i.add(j).addClass(c.className),"short"===c.className||"bad"===c.className?(m.prop("checked")||n.prop("disabled",!0),l.show()):(n.prop("disabled",!1),l.hide())))})}function d(){var a=g.find(".wp-hide-pw");a.show().on("click",function(){1===parseInt(a.data("toggle"),10)?(h.addClass("show-password"),a.data("toggle",0).attr({"aria-label":userProfileL10n.ariaHide}).find(".text").text(userProfileL10n.hide).end().find(".dashicons").removeClass("dashicons-visibility").addClass("dashicons-hidden"),j.focus(),_.isUndefined(j[0].setSelectionRange)||j[0].setSelectionRange(0,100)):(h.removeClass("show-password"),a.data("toggle",1).attr({"aria-label":userProfileL10n.ariaShow}).find(".text").text(userProfileL10n.show).end().find(".dashicons").removeClass("dashicons-hidden").addClass("dashicons-visibility"),i.focus(),_.isUndefined(i[0].setSelectionRange)||i[0].setSelectionRange(0,100))})}function e(){var e,f,r;g=a(".user-pass1-wrap"),a(".user-pass2-wrap").hide(),o=a("#submit").on("click",function(){q=!1}),n=o.add(" #createusersub"),l=a(".pw-weak"),m=l.find(".pw-checkbox"),m.change(function(){n.prop("disabled",!m.prop("checked"))}),i=a("#pass1"),i.length&&c(),k=a("#pass2").on("input propertychange",function(){k.val().length>0&&(i.val(k.val()),k.val(""),p="",i.trigger("pwupdate"))}),e=g.find(".wp-pwd").hide(),d(),f=g.find("button.wp-generate-pw").show(),f.on("click",function(){q=!0,f.hide(),e.show(),0===j.val().length&&b(),_.defer(function(){j.focus(),_.isUndefined(j[0].setSelectionRange)||j[0].setSelectionRange(0,100)},0)}),r=g.find("button.wp-cancel-pw"),r.on("click",function(){q=!1,f.show(),e.hide()}),g.closest("form").on("submit",function(){q=!1,k.val(i.val()),h.removeClass("show-password")})}function f(){var b,c=a("#pass1").val();if(a("#pass-strength-result").removeClass("short bad good strong"),!c)return void a("#pass-strength-result").html(" ");switch(b=wp.passwordStrength.meter(c,wp.passwordStrength.userInputBlacklist(),c)){case 2:a("#pass-strength-result").addClass("bad").html(pwsL10n.bad);break;case 3:a("#pass-strength-result").addClass("good").html(pwsL10n.good);break;case 4:a("#pass-strength-result").addClass("strong").html(pwsL10n.strong);break;case 5:a("#pass-strength-result").addClass("short").html(pwsL10n.mismatch);break;default:a("#pass-strength-result").addClass("short").html(pwsL10n["short"])}}var g,h,i,j,k,l,m,n,o,p,q=!1;a(document).ready(function(){var b,c,d,g,h=a("#display_name");a("#pass1").val("").on("input propertychange pwupdate",f),a("#pass-strength-result").show(),a(".color-palette").click(function(){a(this).siblings('input[name="admin_color"]').prop("checked",!0)}),h.length&&a("#first_name, #last_name, #nickname").bind("blur.user_profile",function(){var b=[],c={display_nickname:a("#nickname").val()||"",display_username:a("#user_login").val()||"",display_firstname:a("#first_name").val()||"",display_lastname:a("#last_name").val()||""};c.display_firstname&&c.display_lastname&&(c.display_firstlast=c.display_firstname+" "+c.display_lastname,c.display_lastfirst=c.display_lastname+" "+c.display_firstname),a.each(a("option",h),function(a,c){b.push(c.value)}),a.each(c,function(d,e){if(e){var f=e.replace(/<\/?[a-z][^>]*>/gi,"");c[d].length&&-1===a.inArray(f,b)&&(b.push(f),a("