[fix 5705] fix crash when tapping sign in twice in account recovery
Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
parent
0658cdbdfa
commit
195b70fcdd
|
@ -70,7 +70,7 @@
|
||||||
(defn on-account-recovered [result password {:keys [db] :as cofx}]
|
(defn on-account-recovered [result password {:keys [db] :as cofx}]
|
||||||
(let [data (types/json->clj result)]
|
(let [data (types/json->clj result)]
|
||||||
(handlers-macro/merge-fx cofx
|
(handlers-macro/merge-fx cofx
|
||||||
{:db (assoc-in db [:accounts/recover :processing?] false)}
|
{:db (dissoc db :accounts/recover)}
|
||||||
(validate-recover-result data password))))
|
(validate-recover-result data password))))
|
||||||
|
|
||||||
(defn recover-account [{:keys [db]}]
|
(defn recover-account [{:keys [db]}]
|
||||||
|
@ -79,13 +79,15 @@
|
||||||
:accounts.recover/recover-account [(security/mask-data passphrase) password]}))
|
:accounts.recover/recover-account [(security/mask-data passphrase) password]}))
|
||||||
|
|
||||||
(defn recover-account-with-checks [{:keys [db] :as cofx}]
|
(defn recover-account-with-checks [{:keys [db] :as cofx}]
|
||||||
(let [{:keys [passphrase]} (:accounts/recover db)]
|
(let [{:keys [passphrase processing?]} (:accounts/recover db)]
|
||||||
(if (mnemonic/status-generated-phrase? passphrase)
|
(when-not processing?
|
||||||
(recover-account cofx)
|
(if (mnemonic/status-generated-phrase? passphrase)
|
||||||
{:ui/show-confirmation {:title (i18n/label :recovery-typo-dialog-title)
|
(recover-account cofx)
|
||||||
:content (i18n/label :recovery-typo-dialog-description)
|
{:ui/show-confirmation
|
||||||
:confirm-button-text (i18n/label :recovery-confirm-phrase)
|
{:title (i18n/label :recovery-typo-dialog-title)
|
||||||
:on-accept #(re-frame/dispatch [:accounts.recover.ui/recover-account-confirmed])}})))
|
:content (i18n/label :recovery-typo-dialog-description)
|
||||||
|
:confirm-button-text (i18n/label :recovery-confirm-phrase)
|
||||||
|
:on-accept #(re-frame/dispatch [:accounts.recover.ui/recover-account-confirmed])}}))))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:accounts.recover/recover-account
|
:accounts.recover/recover-account
|
||||||
|
|
|
@ -47,9 +47,10 @@
|
||||||
:error (when error (i18n/label error))}]])
|
:error (when error (i18n/label error))}]])
|
||||||
|
|
||||||
(defview recover []
|
(defview recover []
|
||||||
(letsubs [{:keys [passphrase password processing passphrase-valid? password-valid?
|
(letsubs [recovered-account [:get-recover-account]]
|
||||||
password-error passphrase-error passphrase-warning processing?]} [:get-recover-account]]
|
(let [{:keys [passphrase password processing passphrase-valid? password-valid?
|
||||||
(let [valid-form? (and password-valid? passphrase-valid?)]
|
password-error passphrase-error passphrase-warning processing?]} recovered-account
|
||||||
|
valid-form? (and password-valid? passphrase-valid?)]
|
||||||
[react/keyboard-avoiding-view {:style styles/screen-container}
|
[react/keyboard-avoiding-view {:style styles/screen-container}
|
||||||
[status-bar/status-bar]
|
[status-bar/status-bar]
|
||||||
[toolbar/toolbar nil toolbar/default-nav-back
|
[toolbar/toolbar nil toolbar/default-nav-back
|
||||||
|
@ -69,6 +70,5 @@
|
||||||
[components.common/bottom-button
|
[components.common/bottom-button
|
||||||
{:forward? true
|
{:forward? true
|
||||||
:label (i18n/label :t/sign-in)
|
:label (i18n/label :t/sign-in)
|
||||||
:disabled? (or processing? (not valid-form?))
|
:disabled? (or (not recovered-account) processing? (not valid-form?))
|
||||||
:on-press (utils.core/wrap-call-once!
|
:on-press #(re-frame/dispatch [:accounts.recover.ui/sign-in-button-pressed])}]])])))
|
||||||
#(re-frame/dispatch [:accounts.recover.ui/sign-in-button-pressed]))}]])])))
|
|
||||||
|
|
Loading…
Reference in New Issue