mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 00:19:07 -05:00
🐛 Fix error handling on verify-token page
This commit is contained in:
parent
c45a105186
commit
56160cf64d
1 changed files with 19 additions and 18 deletions
|
@ -70,27 +70,28 @@
|
||||||
(rx/subs!
|
(rx/subs!
|
||||||
(fn [tdata]
|
(fn [tdata]
|
||||||
(handle-token tdata))
|
(handle-token tdata))
|
||||||
(fn [{:keys [type code] :as error}]
|
(fn [cause]
|
||||||
(cond
|
(let [{:keys [type code] :as error} (ex-data cause)]
|
||||||
(or (= :validation type)
|
(cond
|
||||||
(= :invalid-token code)
|
(or (= :validation type)
|
||||||
(= :token-expired (:reason error)))
|
(= :invalid-token code)
|
||||||
(reset! bad-token true)
|
(= :token-expired (:reason error)))
|
||||||
|
(reset! bad-token true)
|
||||||
|
|
||||||
(= :email-already-exists code)
|
(= :email-already-exists code)
|
||||||
(let [msg (tr "errors.email-already-exists")]
|
(let [msg (tr "errors.email-already-exists")]
|
||||||
(ts/schedule 100 #(st/emit! (msg/error msg)))
|
(ts/schedule 100 #(st/emit! (msg/error msg)))
|
||||||
(st/emit! (rt/nav :auth-login)))
|
(st/emit! (rt/nav :auth-login)))
|
||||||
|
|
||||||
(= :email-already-validated code)
|
(= :email-already-validated code)
|
||||||
(let [msg (tr "errors.email-already-validated")]
|
(let [msg (tr "errors.email-already-validated")]
|
||||||
(ts/schedule 100 #(st/emit! (msg/warn msg)))
|
(ts/schedule 100 #(st/emit! (msg/warn msg)))
|
||||||
(st/emit! (rt/nav :auth-login)))
|
(st/emit! (rt/nav :auth-login)))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(let [msg (tr "errors.generic")]
|
(let [msg (tr "errors.generic")]
|
||||||
(ts/schedule 100 #(st/emit! (msg/error msg)))
|
(ts/schedule 100 #(st/emit! (msg/error msg)))
|
||||||
(st/emit! (rt/nav :auth-login))))))))
|
(st/emit! (rt/nav :auth-login)))))))))
|
||||||
|
|
||||||
(if @bad-token
|
(if @bad-token
|
||||||
[:> static/invalid-token {}]
|
[:> static/invalid-token {}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue