JS password strength detection

1  // check password strength 
2      function CheckPassword (value) {
 3          // 0: Level 1 represents a: represents a second level 2: shows a third level 
4          @ 3: represents the fourth level 4: shows a fifth level 
. 5          var Modes = 0 ;
 . 6          IF (value.length <. 6) { // initial level 
. 7              return Modes;
 . 8          }
 . 9          the console.log (/ \ D / .test (value));
 10          IF ( /\d/.test(value)) { // If the password entered by the user may contain the number 
. 11              Modes ++ ;
 12 is          }
 13 is          IF(. / [AZ] / Test (value)) { // If the password entered by the user to include a lower case Z 
14              Modes ++ ;
 15          }
 16          IF (. / [AZ] / Test (value)) { // if user-entered password contains uppercase a to the Z 
. 17              Modes ++ ;
 18 is          }
 . 19          IF (/\W/.test(value)) { // if non-alphanumeric underscore 
20 is              Modes ++ ;
 21 is          }
 22 is          Switch (Modes) {
 23 is              Case . 1 :
 24                  return . 1 ;
 25                  BREAK ;
 26 is             case 2 :
27                 return 2;
28                 break;
29             case 3 :
30                 return 3;
31                 break;
32             case 4 :
33                 return 4;
34                 break;
35         }
36     }

 

 

Learn to: https://www.jb51.net/article/113524.htm

Guess you like

Origin www.cnblogs.com/nelsonlei/p/11576517.html