Created
April 24, 2012 15:27
-
-
Save rwatts07/2480610 to your computer and use it in GitHub Desktop.
Password validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override lazy val password = new MappedPassword(this) { | |
private def validatePassword(passwordText: String): List[FieldError] = { | |
Password.validate(passwordText) match { | |
case Password.Error.Length => List(FieldError(this, Text(S.??("Password too short")))) | |
case Password.Error.Groups => List(FieldError(this, Text(S.??("Password must contain at least 3 different character classes")))) | |
case _ => Nil | |
} | |
} | |
override def validations = validatePassword _ :: super.validations | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment