Skip to content

Commit

Permalink
handle recovery error
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryn committed Aug 12, 2019
1 parent 197adf5 commit ca0e2ce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/status_im/multiaccounts/login/core.cljs
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -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]}]
Expand Down
14 changes: 14 additions & 0 deletions src/status_im/multiaccounts/recover/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ca0e2ce

Please sign in to comment.