-
-
Save jcromartie/660666aff8742ab77ad9 to your computer and use it in GitHub Desktop.
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
(def common-login-validator | |
(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 | |
(validator | |
common-login-validator | |
(custom "Choose another username" :username (comp model/find-user :username)) | |
(must-match "Password and confirmation must match" :password :confirm))) | |
(def login-validator | |
(validator | |
common-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