From 11f49093155f8aab645b361a0b768e7fbd473c2a Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Wed, 29 Jul 2015 04:29:36 +0000 Subject: [PATCH] Do not re-generate the password after pressing "cancel". Persist the state. Also removes pass2 code not needed since we're generating from one field. fixes #33164 git-svn-id: https://develop.svn.wordpress.org/trunk@33475 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/user-profile.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/js/user-profile.js b/src/wp-admin/js/user-profile.js index 4f78fbf068..799ee97276 100644 --- a/src/wp-admin/js/user-profile.js +++ b/src/wp-admin/js/user-profile.js @@ -178,7 +178,9 @@ $generateButton.hide(); $passwordWrapper.show(); - generatePassword(); + if ( $pass1Text.val().length === 0 ) { + generatePassword(); + } _.defer( function() { $pass1Text.focus(); @@ -205,7 +207,7 @@ } function check_pass_strength() { - var pass1 = $('#pass1').val(), pass2 = $('#pass2').val(), strength; + var pass1 = $('#pass1').val(), strength; $('#pass-strength-result').removeClass('short bad good strong'); if ( ! pass1 ) { @@ -213,7 +215,7 @@ return; } - strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2 ); + strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass1 ); switch ( strength ) { case 2: