This commit is contained in:
looly
2021-12-20 09:34:14 +08:00
parent 8af31805a3
commit 2b4f70f88d
3 changed files with 9 additions and 2 deletions

View File

@@ -159,7 +159,7 @@ public class PasswdStrength {
}
}
if (StrUtil.isNumeric(passwd) && len >= 6) { // 19881010 or 881010
if (StrUtil.isNumeric(passwd) && len >= 6 && len <= 8) { // 19881010 or 881010
int year = 0;
if (len == 8 || len == 6) {
year = Integer.parseInt(passwd.substring(0, len - 4));

View File

@@ -9,4 +9,10 @@ public class PasswdStrengthTest {
String passwd = "2hAj5#mne-ix.86H";
Assert.assertEquals(13, PasswdStrength.check(passwd));
}
@Test
public void strengthNumberTest(){
String passwd = "9999999999999";
Assert.assertEquals(0, PasswdStrength.check(passwd));
}
}