Add validation on route ChangePasswordCitizenRequest

This commit is contained in:
2021-04-08 17:55:05 +02:00
parent eb399392c9
commit 9d3eeeb04b
7 changed files with 23 additions and 9 deletions

View File

@@ -10,7 +10,7 @@ fun ValidationBuilder<String>.passwordScore(minScore: Int) =
fun String.passwordScore(): Int {
var score: Int = length
val alphaNum = ('a'..'z').toList() + ('A'..'Z').toList() + ('0'..'9').toList()
val specialCount = (length - toList().intersect(alphaNum).size)
val specialCount = length - toList().intersect(alphaNum).size
score += specialCount.let { if (it > 3) 3 else it }
val hasAlphaLower = toList().intersect(('a'..'z').toList()).size.let { if (it > 2) 2 else it }