0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 16:21:57 -05:00

🐛 Fix incorrect redirect on login with different user after logout

This commit is contained in:
Andrey Antukh 2024-02-15 14:57:50 +01:00
parent 41794c5f5e
commit 90cb2c4518
2 changed files with 10 additions and 4 deletions

View file

@ -227,9 +227,14 @@
(ptk/reify ::login-from-token
ptk/WatchEvent
(watch [_ _ _]
(rx/of (logged-in
(with-meta profile
{::ev/source "login-with-token"}))))))
(->> (rx/of (logged-in (with-meta profile {::ev/source "login-with-token"})))
;; NOTE: we need this to be asynchronous because the effect
;; should be called before proceed with the login process
(rx/observe-on :async)))
ptk/EffectEvent
(effect [_ _ _]
(set-current-team! nil))))
(defn login-from-register
"Event used mainly for mark current session as logged-in in after the
@ -274,6 +279,7 @@
(effect [_ _ _]
;; We prefer to keek some stuff in the storage like the current-team-id and the profile
(swap! storage dissoc :redirect-url)
(set-current-team! nil)
(i18n/reset-locale)))))
(defn logout

View file

@ -25,7 +25,7 @@
(defmethod handle-token :verify-email
[data]
(let [msg (tr "dashboard.notifications.email-verified-successfully")]
(ts/schedule 100 #(st/emit! (dm/success msg)))
(ts/schedule 1000 #(st/emit! (dm/success msg)))
(st/emit! (du/login-from-token data))))
(defmethod handle-token :change-email