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
|
||||
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
|
||||
SELECT *
|
||||
FROM users u, repositories r
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
(jdbc/with-db-connection [con-db *db*]
|
||||
(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?
|
||||
[user-id]
|
||||
(jdbc/with-db-connection [con-db *db*]
|
||||
|
|
|
@ -23,7 +23,10 @@
|
|||
:on-testnet? (env :on-testnet)}))
|
||||
|
||||
(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 []
|
||||
(layout/render "welcome.html"))
|
||||
|
|
|
@ -59,4 +59,9 @@
|
|||
(catch Throwable t
|
||||
(log/error "Failed to create hubspot contact" t))))
|
||||
(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…
Reference in New Issue