mirror of
https://github.com/penpot/penpot.git
synced 2025-06-04 04:11:39 +02:00
✨ Login with Gitlab
This commit is contained in:
parent
dcd7e0b3cc
commit
cc1353300e
9 changed files with 207 additions and 1 deletions
|
@ -14,6 +14,7 @@
|
|||
(def default-language "en")
|
||||
(def demo-warning (obj/get global "appDemoWarning" false))
|
||||
(def google-client-id (obj/get global "appGoogleClientID" nil))
|
||||
(def gitlab-client-id (obj/get global "appGitlabClientID" nil))
|
||||
(def login-with-ldap (obj/get global "appLoginWithLDAP" false))
|
||||
(def worker-uri (obj/get global "appWorkerURI" "/js/worker.js"))
|
||||
(def public-uri (or (obj/get global "appPublicURI")
|
||||
|
|
|
@ -71,6 +71,12 @@
|
|||
(->> (http/send! {:method :post :uri uri})
|
||||
(rx/mapcat handle-response))))
|
||||
|
||||
(defmethod mutation :login-with-gitlab
|
||||
[id params]
|
||||
(let [uri (str cfg/public-uri "/api/oauth/gitlab")]
|
||||
(->> (http/send! {:method :post :uri uri})
|
||||
(rx/mapcat handle-response))))
|
||||
|
||||
(defmethod mutation :upload-media-object
|
||||
[id params]
|
||||
(let [form (js/FormData.)]
|
||||
|
|
|
@ -40,6 +40,13 @@
|
|||
(rx/subs (fn [{:keys [redirect-uri] :as rsp}]
|
||||
(.replace js/location redirect-uri)))))
|
||||
|
||||
(defn- login-with-gitlab
|
||||
[event]
|
||||
(dom/prevent-default event)
|
||||
(->> (rp/mutation! :login-with-gitlab {})
|
||||
(rx/subs (fn [{:keys [redirect-uri] :as rsp}]
|
||||
(.replace js/location redirect-uri)))))
|
||||
|
||||
(mf/defc login-form
|
||||
[{:keys [locale] :as props}]
|
||||
(let [error? (mf/use-state false)
|
||||
|
@ -113,6 +120,13 @@
|
|||
{:on-click login-with-google}
|
||||
"Login with Google"])
|
||||
|
||||
(when cfg/gitlab-client-id
|
||||
[:a.btn-ocean.btn-large.btn-gitlab-auth
|
||||
{:on-click login-with-gitlab}
|
||||
[:img.logo
|
||||
{:src "/images/icons/brand-gitlab.svg"}]
|
||||
"Login with Gitlab"])
|
||||
|
||||
[:div.links.demo
|
||||
[:div.link-entry
|
||||
[:span (t locale "auth.create-demo-profile-label") " "]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue