mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 07:50:43 -05:00
✨ Add minor improvements on how logout is handled
The profile-id is now required on the body of logout request
This commit is contained in:
parent
3d7f399a50
commit
6896a4e9f0
2 changed files with 21 additions and 8 deletions
|
@ -130,12 +130,21 @@
|
||||||
|
|
||||||
;; ---- COMMAND: Logout
|
;; ---- COMMAND: Logout
|
||||||
|
|
||||||
|
(def ^:private schema:logout
|
||||||
|
[:map {:title "logoug"}
|
||||||
|
[:profile-id {:optional true} ::sm/uuid]])
|
||||||
|
|
||||||
(sv/defmethod ::logout
|
(sv/defmethod ::logout
|
||||||
"Clears the authentication cookie and logout the current session."
|
"Clears the authentication cookie and logout the current session."
|
||||||
{::rpc/auth false
|
{::rpc/auth false
|
||||||
::doc/added "1.15"}
|
::doc/changes [["2.1" "Now requires profile-id passed in the body"]]
|
||||||
[cfg _]
|
::doc/added "1.0"
|
||||||
(rph/with-transform {} (session/delete-fn cfg)))
|
::sm/params schema:logout}
|
||||||
|
[cfg params]
|
||||||
|
(if (= (:profile-id params)
|
||||||
|
(::rpc/profile-id params))
|
||||||
|
(rph/with-transform {} (session/delete-fn cfg))
|
||||||
|
{}))
|
||||||
|
|
||||||
;; ---- COMMAND: Recover Profile
|
;; ---- COMMAND: Recover Profile
|
||||||
|
|
||||||
|
|
|
@ -328,11 +328,15 @@
|
||||||
(-data [_] {})
|
(-data [_] {})
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ _]
|
(watch [_ state _]
|
||||||
(->> (rp/cmd! :logout)
|
(let [profile-id (:profile-id state)]
|
||||||
|
(->> (rx/interval 500)
|
||||||
|
(rx/take 1)
|
||||||
|
(rx/mapcat (fn [_]
|
||||||
|
(->> (rp/cmd! :logout {:profile-id profile-id})
|
||||||
(rx/delay-at-least 300)
|
(rx/delay-at-least 300)
|
||||||
(rx/catch (constantly (rx/of 1)))
|
(rx/catch (constantly (rx/of 1))))))
|
||||||
(rx/map #(logged-out params)))))))
|
(rx/map #(logged-out params))))))))
|
||||||
|
|
||||||
;; --- Update Profile
|
;; --- Update Profile
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue