1function checkStrength(password) { 2 var strength = 0; 3 if (password.length < 8) { 4 $('#strengthMessage').removeClass(); 5 $('#strengthMessage').addClass('Short'); 6 return 'Too short'; 7 } 8 if (password.length > 9) strength += 1; 9 // If password contains both lower and uppercase characters, increase strength value. 10 if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) { 11 strength += 1; 12 } 13 // If it has numbers and characters, increase strength value. 14 if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/)) { 15 strength += 1; 16 } 17 // If it has one special character, increase strength value. 18 if (password.match(/([!,%,&,@,#,$,^,*,?,_,~])/)) { 19 strength += 1; 20 } 21 // If it has two special characters, increase strength value. 22 if (password.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/)) 23 { 24 strength += 1; 25 } 26 // Calculated strength value, we can return messages 27 // If value is less than 2 28 if (strength < 2) { 29 $('#strengthMessage').removeClass(); 30 $('#strengthMessage').addClass('Weak'); 31 return 'Weak'; 32 } else if (strength == 2) { 33 $('#strengthMessage').removeClass(); 34 $('#strengthMessage').addClass('Good'); 35 return 'Good'; 36 } else { 37 $('#strengthMessage').removeClass(); 38 $('#strengthMessage').addClass('Strong'); 39 return 'Strong'; 40 } 41}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.