Created
October 20, 2013 13:57
-
-
Save alioguzhan/7070012 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
(defn handle-register [username email pass1 pass2] | |
(if(has-values?[username email pass1 pass2]) | |
(json {:resp "Please fill all fields."})) | |
(if(not(= pass1 pass2)) | |
(json {:resp "Passwords dont match."})) | |
(if(not(nil?(db/get-user-by-username username))) | |
(json {:username "This username already exists."})) | |
(if (nil?(db/get-user email)) | |
(do | |
(db/add-user-record {:username username | |
:email email | |
:password (crypt/encrypt pass1)}) | |
(let [user (db/get-user email)] | |
(session/put! :user user)) | |
(redirect "/admin")) | |
(json {:email "This email already exists"}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment