diff --git a/src/status_im/multiaccounts/login/core.cljs b/src/status_im/multiaccounts/login/core.cljs index e618759cb941..8ae05a61740c 100644 --- a/src/status_im/multiaccounts/login/core.cljs +++ b/src/status_im/multiaccounts/login/core.cljs @@ -1,6 +1,7 @@ (ns status-im.multiaccounts.login.core (:require [re-frame.core :as re-frame] [status-im.multiaccounts.model :as multiaccounts.model] + [status-im.multiaccounts.recover.core :as multiaccounts.recover] [status-im.chaos-mode.core :as chaos-mode] [status-im.data-store.core :as data-store] [status-im.ethereum.json-rpc :as json-rpc] @@ -283,11 +284,13 @@ (fx/defn verify-multiaccount [{:keys [db] :as cofx} {:keys [realm-error]}] - (fx/merge cofx - {:db (-> db - (assoc :node/on-ready :verify-multiaccount) - (assoc :realm-error realm-error))} - (node/initialize nil))) + (if (get-in db [:multiaccounts/recover]) + (multiaccounts.recover/on-recovery-error cofx) + (fx/merge cofx + {:db (-> db + (assoc :node/on-ready :verify-multiaccount) + (assoc :realm-error realm-error))} + (node/initialize nil)))) (fx/defn unknown-realm-error [cofx {:keys [realm-error erase-button]}] diff --git a/src/status_im/multiaccounts/recover/core.cljs b/src/status_im/multiaccounts/recover/core.cljs index 77bc624263e8..bda442a19b6d 100644 --- a/src/status_im/multiaccounts/recover/core.cljs +++ b/src/status_im/multiaccounts/recover/core.cljs @@ -89,6 +89,20 @@ (multiaccounts.create/on-multiaccount-created cofx multiaccount' password {:seed-backed-up? true}))))) +(fx/defn on-recovery-error + [{:keys [db] :as cofx}] + (fx/merge cofx + {:db (-> db + (update :multiaccounts/recover assoc + :processing? false + :password "" + :password-confirmation "" + :password-error :recover-password-invalid) + (update :multiaccounts/recover dissoc + :password-valid?)) + :node/stop nil} + (navigation/navigate-to-cofx :recover-multiaccount-enter-password nil))) + (fx/defn on-multiaccount-recovered {:events [:multiaccounts.recover.callback/recover-multiaccount-success] :interceptors [(re-frame/inject-cofx :random-guid-generator)