Ticket #10396: js_pass_check_a.diff
File js_pass_check_a.diff, 4.1 KB (added by , 15 years ago) |
---|
-
wp-includes/script-loader.php
260 260 /* translators: password strength */ 261 261 'good' => _x('Medium', 'password strength'), 262 262 'strong' => __('Strong'), 263 'mismatch' => __('Mismatch'), 263 264 'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};' 264 265 ) ); 265 266 -
wp-admin/js/password-strength-meter.dev.js
1 1 // Password strength meter 2 function passwordStrength(password ,username) {3 var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, symbolSize = 0, natLog, score;2 function passwordStrength(password1,username,password2) { 3 var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, mismatch = 5, symbolSize = 0, natLog, score; 4 4 5 // password 1 != password 2 6 if ( (password1 != password2) && password2.length > 0) { return mismatch }; 5 7 //password < 4 6 if (password.length < 4 ) { return shortPass };8 if (password1.length < 4 ) { return shortPass }; 7 9 8 //password== username9 if (password.toLowerCase()==username.toLowerCase()) return badPass;10 //password1 == username 11 if (password1.toLowerCase()==username.toLowerCase()) return badPass; 10 12 11 if (password .match(/[0-9]/)) symbolSize +=10;12 if (password .match(/[a-z]/)) symbolSize +=26;13 if (password .match(/[A-Z]/)) symbolSize +=26;14 if (password .match(/[^a-zA-Z0-9]/)) symbolSize +=31;13 if (password1.match(/[0-9]/)) symbolSize +=10; 14 if (password1.match(/[a-z]/)) symbolSize +=26; 15 if (password1.match(/[A-Z]/)) symbolSize +=26; 16 if (password1.match(/[^a-zA-Z0-9]/)) symbolSize +=31; 15 17 16 natLog = Math.log( Math.pow(symbolSize,password .length) );18 natLog = Math.log( Math.pow(symbolSize,password1.length) ); 17 19 score = natLog / Math.LN2; 18 20 if (score < 40 ) return badPass 19 21 if (score < 56 ) return goodPass -
wp-admin/js/user-profile.dev.js
1 1 (function($){ 2 2 3 3 function check_pass_strength() { 4 var pass = $('#pass1').val(), user = $('#user_login').val(), strength;4 var pass1 = $('#pass1').val(), user = $('#user_login').val(), pass2 = $('#pass2').val(), strength; 5 5 6 6 $('#pass-strength-result').removeClass('short bad good strong'); 7 if ( ! pass ) {7 if ( ! pass1 ) { 8 8 $('#pass-strength-result').html( pwsL10n.empty ); 9 9 return; 10 10 } 11 11 12 strength = passwordStrength(pass , user);12 strength = passwordStrength(pass1, user, pass2); 13 13 14 14 switch ( strength ) { 15 15 case 2: … … 21 21 case 4: 22 22 $('#pass-strength-result').addClass('strong').html( pwsL10n['strong'] ); 23 23 break; 24 case 5: 25 $('#pass-strength-result').addClass('short').html( pwsL10n['mismatch'] ); 26 break; 24 27 default: 25 28 $('#pass-strength-result').addClass('short').html( pwsL10n['short'] ); 26 29 } … … 28 31 29 32 $(document).ready( function() { 30 33 $('#pass1').val('').keyup( check_pass_strength ); 34 $('#pass2').val('').keyup( check_pass_strength ); 31 35 $('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')}); 32 36 $('#nickname').blur(function(){ 33 37 var str = $(this).val() || $('#user_login').val(); -
wp-admin/install.php
239 239 short: "<?php echo esc_js( __( 'Very weak' ) ); ?>", 240 240 bad: "<?php echo esc_js( __( 'Weak' ) ); ?>", 241 241 good: "<?php echo esc_js( __( 'Medium' ) ); ?>", 242 strong: "<?php echo esc_js( __( 'Strong' ) ); ?>" 242 strong: "<?php echo esc_js( __( 'Strong' ) ); ?>", 243 mismatch: "<?php echo esc_js( __( 'Mismatch' ) ); ?>" 243 244 }; 244 245 try{convertEntities(pwsL10n);}catch(e){}; 245 246 /* ]]> */