-
-
Save chadhs/8798193e3b70b1c08c2427ad59f04f94 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-auth-login [req] | |
(let [email (get-in req [:params :email]) | |
password (get-in req [:params :password]) | |
authfacts (auth.model/read-account-auth-facts db-url {:account-email email}) | |
account-id (get authfacts :id) | |
passhash (get authfacts :password_hash) | |
hashcalc (hashers/check password passhash) | |
login-error (cond (nil? account-id) :account-id | |
(false? hashcalc) :password)] | |
(if (nil? login-error) | |
(do | |
(timbre/info (str "account authenticated successfully: " account-id " : " email)) | |
(response/redirect "/lists")) | |
(do | |
(timbre/error (str "account authentication failure reason " login-error " " account-id " : " email)) | |
{:status 200 | |
:headers {"Content-Type" "text/html"} | |
:body (auth.view.login/login-page login-error)})))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment