Skip to content

Instantly share code, notes, and snippets.

@rwatts07
Created April 24, 2012 15:27
Show Gist options
  • Save rwatts07/2480610 to your computer and use it in GitHub Desktop.
Save rwatts07/2480610 to your computer and use it in GitHub Desktop.
Password validation
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