mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-16 04:24:12 +00:00
Add :dev-login for quick dev tasks when OAuth/GitHub app are not
required
This commit is contained in:
parent
4437e13657
commit
9008f675f3
@ -43,6 +43,13 @@ SELECT *
|
|||||||
FROM users
|
FROM users
|
||||||
WHERE id = :id;
|
WHERE id = :id;
|
||||||
|
|
||||||
|
-- :name get-user-by-login :? :1
|
||||||
|
-- :doc retrieve a user given GitHub login.
|
||||||
|
SELECT *
|
||||||
|
FROM users
|
||||||
|
WHERE login = :login;
|
||||||
|
|
||||||
|
|
||||||
-- :name get-repo-owner :? :1
|
-- :name get-repo-owner :? :1
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM users u, repositories r
|
FROM users u, repositories r
|
||||||
|
@ -21,6 +21,11 @@
|
|||||||
(jdbc/with-db-connection [con-db *db*]
|
(jdbc/with-db-connection [con-db *db*]
|
||||||
(db/get-user con-db {:id user-id})))
|
(db/get-user con-db {:id user-id})))
|
||||||
|
|
||||||
|
(defn get-user-by-login
|
||||||
|
[login]
|
||||||
|
(jdbc/with-db-connection [con-db *db*]
|
||||||
|
(db/get-user-by-login con-db {:login login})))
|
||||||
|
|
||||||
(defn exists?
|
(defn exists?
|
||||||
[user-id]
|
[user-id]
|
||||||
(jdbc/with-db-connection [con-db *db*]
|
(jdbc/with-db-connection [con-db *db*]
|
||||||
|
@ -23,7 +23,10 @@
|
|||||||
:on-testnet? (env :on-testnet)}))
|
:on-testnet? (env :on-testnet)}))
|
||||||
|
|
||||||
(defn landing-page []
|
(defn landing-page []
|
||||||
(layout/render "index.html" {:authorize-url (github/signup-authorize-url)}))
|
(layout/render "index.html"
|
||||||
|
{:authorize-url (if (env :dev-login)
|
||||||
|
(str (env :server-address) "/callback_dev")
|
||||||
|
(github/signup-authorize-url))}))
|
||||||
|
|
||||||
(defn welcome-page []
|
(defn welcome-page []
|
||||||
(layout/render "welcome.html"))
|
(layout/render "welcome.html"))
|
||||||
|
@ -59,4 +59,9 @@
|
|||||||
(catch Throwable t
|
(catch Throwable t
|
||||||
(log/error "Failed to create hubspot contact" t))))
|
(log/error "Failed to create hubspot contact" t))))
|
||||||
(assoc (found (str (env :server-address) "/app"))
|
(assoc (found (str (env :server-address) "/app"))
|
||||||
:session {:identity user}))))))
|
:session {:identity user})))))
|
||||||
|
(GET "/callback_dev" []
|
||||||
|
(assoc (found (str (env :server-address) "/app"))
|
||||||
|
:session {:identity (users/get-user-by-login (env :dev-login))}))
|
||||||
|
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user