From 119713f3da1c2b916551126f39bbf0f1c0175156 Mon Sep 17 00:00:00 2001 From: scribu Date: Tue, 12 Oct 2010 21:37:01 +0000 Subject: [PATCH] first pass at strength indicator on password reset. see #5919 git-svn-id: http://svn.automattic.com/wordpress/trunk@15782 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/login.css | 2 +- wp-admin/css/login.dev.css | 10 +++++++++ wp-includes/script-loader.php | 2 +- wp-login.php | 39 ++++++++++++++++++++++++++++++----- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/wp-admin/css/login.css b/wp-admin/css/login.css index a2b13b6a75..127603168d 100644 --- a/wp-admin/css/login.css +++ b/wp-admin/css/login.css @@ -1 +1 @@ -*{margin:0;padding:0;}body{padding-top:30px;font:11px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}form{margin-left:8px;padding:16px 16px 40px 16px;font-weight:normal;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;background:#fff;border:1px solid #e5e5e5;-moz-box-shadow:rgba(200,200,200,1) 0 4px 18px;-webkit-box-shadow:rgba(200,200,200,1) 0 4px 18px;-khtml-box-shadow:rgba(200,200,200,1) 0 4px 18px;box-shadow:rgba(200,200,200,1) 0 4px 18px;}form .forgetmenot{font-weight:normal;float:left;margin-bottom:0;}.button-primary{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;padding:3px 10px;border:none;font-size:12px;border-width:1px;border-style:solid;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;cursor:pointer;text-decoration:none;margin-top:-3px;}#login form p{margin-bottom:0;}label{color:#777;font-size:13px;}form .forgetmenot label{font-size:11px;line-height:19px;}form .submit,.alignright{float:right;}form p{margin-bottom:24px;}h1 a{background:url(../images/logo-login.gif) no-repeat top center;width:326px;height:67px;text-indent:-9999px;overflow:hidden;padding-bottom:15px;display:block;}#nav{text-shadow:rgba(255,255,255,1) 0 1px 0;}#backtoblog{position:absolute;top:0;left:0;border-bottom:#c6c6c6 1px solid;background:#d9d9d9;background:-moz-linear-gradient(bottom,#d7d7d7,#e4e4e4);background:-webkit-gradient(linear,left bottom,left top,from(#d7d7d7),to(#e4e4e4));height:30px;width:100%;}#backtoblog a{text-decoration:none;display:block;padding:8px 0 0 15px;}#login{width:320px;margin:7em auto;}#login_error,.message{margin:0 0 16px 8px;border-width:1px;border-style:solid;padding:12px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}#nav{margin:0 0 0 8px;padding:16px;}body form .input{font-size:24px;width:97%;padding:3px;margin-top:2px;margin-right:6px;margin-bottom:16px;border:1px solid #e5e5e5;background:#fbfbfb;}input{color:#555;}.clear{clear:both;} \ No newline at end of file +*{margin:0;padding:0;}body{padding-top:30px;font:11px "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;}form{margin-left:8px;padding:16px 16px 40px 16px;font-weight:normal;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;background:#fff;border:1px solid #e5e5e5;-moz-box-shadow:rgba(200,200,200,1) 0 4px 18px;-webkit-box-shadow:rgba(200,200,200,1) 0 4px 18px;-khtml-box-shadow:rgba(200,200,200,1) 0 4px 18px;box-shadow:rgba(200,200,200,1) 0 4px 18px;}form .forgetmenot{font-weight:normal;float:left;margin-bottom:0;}.button-primary{font-family:"Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;padding:3px 10px;border:none;font-size:12px;border-width:1px;border-style:solid;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;cursor:pointer;text-decoration:none;margin-top:-3px;}#login form p{margin-bottom:0;}label{color:#777;font-size:13px;}form .forgetmenot label{font-size:11px;line-height:19px;}form .submit,.alignright{float:right;}form p{margin-bottom:24px;}h1 a{background:url(../images/logo-login.gif) no-repeat top center;width:326px;height:67px;text-indent:-9999px;overflow:hidden;padding-bottom:15px;display:block;}#nav{text-shadow:rgba(255,255,255,1) 0 1px 0;}#backtoblog{position:absolute;top:0;left:0;border-bottom:#c6c6c6 1px solid;background:#d9d9d9;background:-moz-linear-gradient(bottom,#d7d7d7,#e4e4e4);background:-webkit-gradient(linear,left bottom,left top,from(#d7d7d7),to(#e4e4e4));height:30px;width:100%;}#backtoblog a{text-decoration:none;display:block;padding:8px 0 0 15px;}#login{width:320px;margin:7em auto;}#login_error,.message{margin:0 0 16px 8px;border-width:1px;border-style:solid;padding:12px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}#nav{margin:0 0 0 8px;padding:16px;}body form .input{font-size:24px;width:97%;padding:3px;margin-top:2px;margin-right:6px;margin-bottom:16px;border:1px solid #e5e5e5;background:#fbfbfb;}input{color:#555;}.clear{clear:both;}#pass-strength-result{font-weight:bold;border-style:solid;border-width:1px;margin:12px 0 6px;padding:6px 5px;text-align:center;} \ No newline at end of file diff --git a/wp-admin/css/login.dev.css b/wp-admin/css/login.dev.css index 9d0159ed33..6124b87773 100644 --- a/wp-admin/css/login.dev.css +++ b/wp-admin/css/login.dev.css @@ -135,3 +135,13 @@ input { .clear { clear: both; } + +#pass-strength-result { + font-weight: bold; + border-style: solid; + border-width: 1px; + margin: 12px 0 6px; + padding: 6px 5px; + text-align: center; +} + diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 46cee34499..b8af142aaa 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -477,7 +477,7 @@ function wp_default_styles( &$styles ) { $styles->add( 'theme-editor', "/wp-admin/css/theme-editor$suffix.css", array(), '20100514' ); $styles->add( 'press-this', "/wp-admin/css/press-this$suffix.css", array(), '20100424' ); $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' ); - $styles->add( 'login', "/wp-admin/css/login$suffix.css", array(), '20100922' ); + $styles->add( 'login', "/wp-admin/css/login$suffix.css", array(), '20101012' ); $styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20100402' ); $styles->add( 'theme-install', "/wp-admin/css/theme-install$suffix.css", array(), '20100523' ); $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' ); diff --git a/wp-login.php b/wp-login.php index 5d0bf1043a..270c510a87 100644 --- a/wp-login.php +++ b/wp-login.php @@ -334,6 +334,28 @@ function register_new_user( $user_login, $user_email ) { return $user_id; } +// TODO: Eliminate duplicated code from wp_default_scripts() +function load_password_strength_meter() { + if ( !$guessurl = site_url() ) + $guessurl = wp_guess_url(); + + $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; + + wp_enqueue_script( 'user-profile', $guessurl . "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20100331' ); + wp_localize_script( 'user-profile', 'pwsL10n', array( + 'empty' => __('Strength indicator'), + 'short' => __('Very weak'), + 'bad' => __('Weak'), + /* translators: password strength */ + 'good' => _x('Medium', 'password strength'), + 'strong' => __('Strong'), + 'mismatch' => __('Mismatch'), + 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' + ) ); + + wp_print_scripts( array('user-profile') ); +} + // // Main // @@ -445,19 +467,26 @@ case 'rp' : exit; } - login_header(__('Reset Password'), '

' . __('Reset your password') . '

', $errors ); + login_header(__('Reset Password'), '

' . __('Enter your new password below.') . '

', $errors ); + + load_password_strength_meter(); ?>
+ +

- +

- +

+
+

+