From 7569d5519190d9be7473688d7806a4fd0255b982 Mon Sep 17 00:00:00 2001 From: flynn Date: Thu, 14 Feb 2019 04:44:26 +0100 Subject: [PATCH] add shit --- resources/sql/queries.sql | 2 +- src/clj/cat/routes/oauth.clj | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/resources/sql/queries.sql b/resources/sql/queries.sql index 4011d75..8bc12e5 100644 --- a/resources/sql/queries.sql +++ b/resources/sql/queries.sql @@ -10,7 +10,7 @@ VALUES (:name, :gender, :zeusid) --SET first_name = :first_name, last_name = :last_name, email = :email --WHERE id = :id --- :name get-zeus-user :? :1 +-- :name get-zeus-user : reee - found))) + found))) (defn oauth-callback "Handles the callback from adams with the access_token @@ -51,14 +51,16 @@ (let [user (mo/get-user-info access_token)] (log/info "User info: " user) (let [zeususer (db/get-zeus-user {:zeusid (:id user)})] - (println "Zeus user from db: " zeususer) + (log/info "Zeus user from db: " zeususer) (if zeususer (set-user! zeususer session "/") - (-> {:name (:username user) - :gender nil - :zeusid (:id user)} - (db/create-user!,,,) - (set-user!,,, session "/")))))))) + (let [user-template {:name (:username user) + :gender nil + :zeusid (:id user)} + generated-key (-> user-template + (db/create-user!,,,))] + (log/info "Created user: " generated-key) + (set-user! (assoc user-template :id (:generated_key generated-key)) session "/")))))))) ;(catch [:status 401] _ ; (error-page {:status 401