remove unneeded logs

This commit is contained in:
flynn 2019-06-08 19:45:39 +02:00
parent 9d7ebbd23e
commit af90e8639a
2 changed files with 26 additions and 24 deletions

View file

@ -46,13 +46,9 @@
(-> (found "/") (-> (found "/")
(assoc :flash {:denied true})) (assoc :flash {:denied true}))
; fetch the request token and do anything else you wanna do if not denied. ; fetch the request token and do anything else you wanna do if not denied.
(let [{:keys [access_token refresh_token]} (mo/get-authentication-response nil req_token)] (let [{:keys [access_token refresh_token]} (mo/get-authentication-response nil req_token)
(log/debug "Successfully fetched access-id: " access_token) fetched-user (mo/get-user-info access_token)
(log/debug "Fetching user info") local-user (db/get-zeus-user {:zeusid (:id fetched-user)})]
(let [fetched-user (mo/get-user-info access_token)]
(log/debug "Fetched user info: " fetched-user)
(let [local-user (db/get-zeus-user {:zeusid (:id fetched-user)})]
(log/debug "Zeus user from db: " local-user)
(if local-user (if local-user
(set-user! local-user session "/") (set-user! local-user session "/")
(try (try
@ -61,20 +57,26 @@
:zeusid (:id fetched-user)} :zeusid (:id fetched-user)}
generated-key (-> user-template generated-key (-> user-template
(db/create-user!))] (db/create-user!))]
(log/debug "Created user: " generated-key)
(set-user! (assoc user-template :id (:generated_key generated-key)) session "/")) (set-user! (assoc user-template :id (:generated_key generated-key)) session "/"))
(catch Exception e (catch Exception e
(do (do
(log/warn "fetched user" fetched-user "already exists, but was not found") (log/warn "fetched user" fetched-user "already exists, but was not found")
(log/warn (:cause (Throwable->map e))) (log/warn (:cause (Throwable->map e)))
(-> (found "/") (-> (found "/")
(assoc :flash {:error "An error occurred, please try again."}))))))))))) (assoc :flash {:error "An error occurred, please try again."})))))))))
;(catch [:status 401] _ ;(catch [:status 401] _
; (error-page {:status 401 ; (error-page {:status 401
; :title "Error authenticating" ; :title "Error authenticating"
; :message "Please contact your system administrator to fix this issue"})) ; :message "Please contact your system administrator to fix this issue"}))
; TODO catch using
;(defn multiple-status-endpoint [req]
; (let [resp (do-external-request req)]
; (condp = (:status resp)
; 201 (println ok)
; 401 (println error))))
(defroutes oauth-routes (defroutes oauth-routes
(GET "/oauth/oauth-init" req (oauth-init req)) (GET "/oauth/oauth-init" req (oauth-init req))