Skip to content

Instantly share code, notes, and snippets.

@alioguzhan
Created October 20, 2013 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alioguzhan/7070012 to your computer and use it in GitHub Desktop.
Save alioguzhan/7070012 to your computer and use it in GitHub Desktop.
(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