mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 14:31:38 +02:00
♻️ Refactor LDAP auth backend.
And reorganize oauth backend namespaces.
This commit is contained in:
parent
299b29b66f
commit
de394a7d4e
26 changed files with 288 additions and 310 deletions
|
@ -79,30 +79,6 @@
|
|||
(watch [this state s]
|
||||
(rx/of (logged-in profile)))))
|
||||
|
||||
(defn login-with-ldap
|
||||
[{:keys [email password] :as data}]
|
||||
(us/verify ::login-params data)
|
||||
(ptk/reify ::login-with-ldap
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(merge state (dissoc initial-state :route :router)))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [this state s]
|
||||
(let [{:keys [on-error on-success]
|
||||
:or {on-error identity
|
||||
on-success identity}} (meta data)
|
||||
params {:email email
|
||||
:password password
|
||||
:scope "webapp"}]
|
||||
(->> (rx/timer 100)
|
||||
(rx/mapcat #(rp/mutation :login-with-ldap params))
|
||||
(rx/tap on-success)
|
||||
(rx/catch (fn [err]
|
||||
(on-error err)
|
||||
(rx/empty)))
|
||||
(rx/map logged-in))))))
|
||||
|
||||
;; --- Logout
|
||||
|
||||
(def clear-user-data
|
||||
|
@ -131,10 +107,11 @@
|
|||
|
||||
;; --- Register
|
||||
|
||||
(s/def ::invitation-token ::us/not-empty-string)
|
||||
|
||||
(s/def ::register
|
||||
(s/keys :req-un [::fullname
|
||||
::password
|
||||
::email]))
|
||||
(s/keys :req-un [::fullname ::password ::email]
|
||||
:opt-un [::invitation-token]))
|
||||
|
||||
(defn register
|
||||
"Create a register event instance."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue