♻️ Refactor invitation flow

Enfoces security and make the flow more deterministic.
This commit is contained in:
Andrey Antukh 2022-02-15 15:33:59 +01:00 committed by Andrés Moya
parent 6486b24c8b
commit 96facc5100
7 changed files with 117 additions and 156 deletions

View file

@ -41,13 +41,15 @@
[tdata]
(case (:state tdata)
:created
(st/emit! (dm/success (tr "auth.notifications.team-invitation-accepted"))
(du/fetch-profile)
(rt/nav :dashboard-projects {:team-id (:team-id tdata)}))
(st/emit!
(dm/success (tr "auth.notifications.team-invitation-accepted"))
(du/fetch-profile)
(rt/nav :dashboard-projects {:team-id (:team-id tdata)}))
:pending
(let [token (:invitation-token tdata)]
(st/emit! (rt/nav :auth-register {} {:invitation-token token})))))
(let [token (:invitation-token tdata)
route-id (:redirect-to tdata :auth-register)]
(st/emit! (rt/nav route-id {} {:invitation-token token})))))
(defmethod handle-token :default
[_tdata]