Skip to content

Instantly share code, notes, and snippets.

@jcromartie jcromartie/validators.clj Secret
Created Jul 29, 2011

What would you like to do?
(def common-login-validator
(required "Username is required" :username)
(required "Password is required" :password)
(regex "Password must be at least 6 characters long" :password #".{6,}")))
(def registration-validator
(custom "Choose another username" :username (comp model/find-user :username))
(must-match "Password and confirmation must match" :password :confirm)))
(def login-validator
(custom "Invalid username or password" :form #(not (model/authenticate
(:username %)
(:password %))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.