Changeset 13900
- Timestamp:
- 03/31/2010 08:45:51 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/install.php
r13770 r13900 250 250 bad: "<?php echo esc_js( __( 'Weak' ) ); ?>", 251 251 good: "<?php echo esc_js( __( 'Medium' ) ); ?>", 252 strong: "<?php echo esc_js( __( 'Strong' ) ); ?>" 252 strong: "<?php echo esc_js( __( 'Strong' ) ); ?>", 253 mismatch: "<?php echo esc_js( __( 'Mismatch' ) ); ?>" 253 254 }; 254 255 try{convertEntities(pwsL10n);}catch(e){}; -
trunk/wp-admin/js/password-strength-meter.dev.js
r10291 r13900 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 5 // password 1 != password 2 6 if ( (password1 != password2) && password2.length > 0) 7 return mismatch 4 8 5 9 //password < 4 6 if (password.length < 4 ) { return shortPass }; 10 if ( password1.length < 4 ) 11 return shortPass 7 12 8 //password == username 9 if (password.toLowerCase()==username.toLowerCase()) return badPass; 13 //password1 == username 14 if ( password1.toLowerCase() == username.toLowerCase() ) 15 return badPass; 10 16 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; 17 if ( password1.match(/[0-9]/) ) 18 symbolSize +=10; 19 if ( password1.match(/[a-z]/) ) 20 symbolSize +=26; 21 if ( password1.match(/[A-Z]/) ) 22 symbolSize +=26; 23 if ( password1.match(/[^a-zA-Z0-9]/) ) 24 symbolSize +=31; 15 25 16 natLog = Math.log( Math.pow(symbolSize, password.length) );26 natLog = Math.log( Math.pow(symbolSize, password1.length) ); 17 27 score = natLog / Math.LN2; 18 if (score < 40 ) return badPass 19 if (score < 56 ) return goodPass 28 29 if (score < 40 ) 30 return badPass 31 32 if (score < 56 ) 33 return goodPass 34 20 35 return strongPass; 21 36 } -
trunk/wp-admin/js/password-strength-meter.js
r10291 r13900 1 function passwordStrength( i,f){var h=1,e=2,b=3,a=4,d=0,g,c;if(i.length<4){return h}if(i.toLowerCase()==f.toLowerCase()){return e}if(i.match(/[0-9]/)){d+=10}if(i.match(/[a-z]/)){d+=26}if(i.match(/[A-Z]/)){d+=26}if(i.match(/[^a-zA-Z0-9]/)){d+=31}g=Math.log(Math.pow(d,i.length));c=g/Math.LN2;if(c<40){return e}if(c<56){return b}return a};1 function passwordStrength(password1,username,password2){var shortPass=1,badPass=2,goodPass=3,strongPass=4,mismatch=5,symbolSize=0,natLog,score;if((password1!=password2)&&password2.length>0){return mismatch}if(password1.length<4){return shortPass}if(password1.toLowerCase()==username.toLowerCase()){return badPass}if(password1.match(/[0-9]/)){symbolSize+=10}if(password1.match(/[a-z]/)){symbolSize+=26}if(password1.match(/[A-Z]/)){symbolSize+=26}if(password1.match(/[^a-zA-Z0-9]/)){symbolSize+=31}natLog=Math.log(Math.pow(symbolSize,password1.length));score=natLog/Math.LN2;if(score<40){return badPass}if(score<56){return goodPass}return strongPass}; -
trunk/wp-admin/js/user-profile.dev.js
r13539 r13900 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 ) { … … 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'] ); … … 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(){ -
trunk/wp-admin/js/user-profile.js
r13539 r13900 1 (function( a){function b(){var d=a("#pass1").val(),c=a("#user_login").val(),e;a("#pass-strength-result").removeClass("short bad good strong");if(!d){a("#pass-strength-result").html(pwsL10n.empty);return}e=passwordStrength(d,c);switch(e){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;default:a("#pass-strength-result").addClass("short").html(pwsL10n["short"])}}a(document).ready(function(){a("#pass1").val("").keyup(b);a(".color-palette").click(function(){a(this).siblings("input[name=admin_color]").attr("checked","checked")});a("#nickname").blur(function(){var e=a(this).val()||a("#user_login").val();var c=a("#display_name");var d=c.children("option:selected").attr("id");c.children("#display_nickname").remove();if(!c.children("option[value="+e+"]").length){c.append('<option id="display_nickname" value="'+e+'">'+e+"</option>")}a("#"+d).attr("selected","selected")});a("#first_name, #last_name").blur(function(){var c=a("#display_name");var f=a("#first_name").val(),d=a("#last_name").val();var e=c.children("option:selected").attr("id");a("#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst").remove();if(f&&!c.children("option[value="+f+"]").length){c.append('<option id="display_firstname" value="'+f+'">'+f+"</option>")}if(d&&!c.children("option[value="+d+"]").length){c.append('<option id="display_lastname" value="'+d+'">'+d+"</option>")}if(f&&d){if(!c.children("option[value="+f+" "+d+"]").length){c.append('<option id="display_firstlast" value="'+f+" "+d+'">'+f+" "+d+"</option>")}if(!c.children("option[value="+d+" "+f+"]").length){c.append('<option id="display_lastfirst" value="'+d+" "+f+'">'+d+" "+f+"</option>")}}a("#"+e).attr("selected","selected")})})})(jQuery);1 (function($){function check_pass_strength(){var pass1=$("#pass1").val(),user=$("#user_login").val(),pass2=$("#pass2").val(),strength;$("#pass-strength-result").removeClass("short bad good strong");if(!pass1){$("#pass-strength-result").html(pwsL10n.empty);return}strength=passwordStrength(pass1,user,pass2);switch(strength){case 2:$("#pass-strength-result").addClass("bad").html(pwsL10n.bad);break;case 3:$("#pass-strength-result").addClass("good").html(pwsL10n.good);break;case 4:$("#pass-strength-result").addClass("strong").html(pwsL10n.strong);break;case 5:$("#pass-strength-result").addClass("short").html(pwsL10n.mismatch);break;default:$("#pass-strength-result").addClass("short").html(pwsL10n["short"])}}$(document).ready(function(){$("#pass1").val("").keyup(check_pass_strength);$("#pass2").val("").keyup(check_pass_strength);$(".color-palette").click(function(){$(this).siblings("input[name=admin_color]").attr("checked","checked")});$("#nickname").blur(function(){var str=$(this).val()||$("#user_login").val();var select=$("#display_name");var sel=select.children("option:selected").attr("id");select.children("#display_nickname").remove();if(!select.children("option[value="+str+"]").length){select.append('<option id="display_nickname" value="'+str+'">'+str+"</option>")}$("#"+sel).attr("selected","selected")});$("#first_name, #last_name").blur(function(){var select=$("#display_name");var first=$("#first_name").val(),last=$("#last_name").val();var sel=select.children("option:selected").attr("id");$("#display_firstname, #display_lastname, #display_firstlast, #display_lastfirst").remove();if(first&&!select.children("option[value="+first+"]").length){select.append('<option id="display_firstname" value="'+first+'">'+first+"</option>")}if(last&&!select.children("option[value="+last+"]").length){select.append('<option id="display_lastname" value="'+last+'">'+last+"</option>")}if(first&&last){if(!select.children("option[value="+first+" "+last+"]").length){select.append('<option id="display_firstlast" value="'+first+" "+last+'">'+first+" "+last+"</option>")}if(!select.children("option[value="+last+" "+first+"]").length){select.append('<option id="display_lastfirst" value="'+last+" "+first+'">'+last+" "+first+"</option>")}}$("#"+sel).attr("selected","selected")})})})(jQuery); -
trunk/wp-includes/script-loader.php
r13833 r13900 252 252 $scripts->add_data( 'admin-custom-fields', 'group', 1 ); 253 253 254 $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20 090102' );254 $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), '20100331' ); 255 255 $scripts->add_data( 'password-strength-meter', 'group', 1 ); 256 256 $scripts->localize( 'password-strength-meter', 'pwsL10n', array( … … 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 ) );
Note: See TracChangeset
for help on using the changeset viewer.