mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-26 09:19:03 +00:00
Revert "Testnet usage related fixes"
This reverts commit d8965025d1eff77758951ed03494272e37708e71.
This commit is contained in:
parent
a90c9569e2
commit
12671cd2c3
@ -12,8 +12,7 @@
|
||||
[clojure.tools.logging :as log]
|
||||
[clojure.string :as str]))
|
||||
|
||||
(defn root-path []
|
||||
(if (env :on-testnet) "/test" "/"))
|
||||
|
||||
|
||||
(defn- create-user [token user]
|
||||
(let [{name :name
|
||||
@ -34,7 +33,7 @@
|
||||
(create-user token user))))
|
||||
|
||||
(defroutes redirect-routes
|
||||
(GET (str (root-path) "callback") [code state]
|
||||
(GET "/callback" [code state]
|
||||
(let [resp (github/post-for-token code state)
|
||||
body (keywordize-keys (codec/form-decode (:body resp)))
|
||||
scope (:scope body)
|
||||
@ -42,10 +41,10 @@
|
||||
(log/debug "github sign-in callback, response body:" body)
|
||||
(if (:error body)
|
||||
;; Why does Mist browser sends two redirects at the same time? The latter results in 401 error.
|
||||
(response/redirect (root-path))
|
||||
(response/redirect "/")
|
||||
(let [admin-token? (str/includes? scope "repo")
|
||||
token-key (if admin-token? :admin-token :token)
|
||||
user (assoc (get-or-create-user access-token)
|
||||
token-key access-token)]
|
||||
(assoc (response/redirect (root-path))
|
||||
(assoc (response/redirect "/")
|
||||
:session {:identity user}))))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user