From 884bbbb813d331da5cb014219ebe170183a9d026 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Sat, 6 Oct 2018 08:23:24 +0300 Subject: [PATCH] [#6122] prevent submitting of recovery phrase when it is empty --- .../ui/screens/accounts/recover/views.cljs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/status_im/ui/screens/accounts/recover/views.cljs b/src/status_im/ui/screens/accounts/recover/views.cljs index 338e28a6fa..cf010cefe6 100644 --- a/src/status_im/ui/screens/accounts/recover/views.cljs +++ b/src/status_im/ui/screens/accounts/recover/views.cljs @@ -36,7 +36,7 @@ :error (cond error (i18n/label error) warning (i18n/label warning))}])) -(defview password-input [password error] +(defview password-input [password error on-submit-editing] [react/view {:style styles/password-input :important-for-accessibility :no-hide-descendants} [text-input/text-input-with-label @@ -48,13 +48,15 @@ :on-blur #(re-frame/dispatch [:accounts.recover.ui/password-input-blured]) :secure-text-entry true :error (when error (i18n/label error)) - :on-submit-editing #(re-frame/dispatch [:accounts.recover.ui/sign-in-button-pressed])}]]) + :on-submit-editing on-submit-editing}]]) (defview recover [] (letsubs [recovered-account [:get-recover-account]] (let [{:keys [passphrase password processing passphrase-valid? password-valid? password-error passphrase-error passphrase-warning processing?]} recovered-account - valid-form? (and password-valid? passphrase-valid?)] + valid-form? (and password-valid? passphrase-valid?) + disabled? (or (not recovered-account) processing? (not valid-form?)) + sign-in #(re-frame/dispatch [:accounts.recover.ui/sign-in-button-pressed])] [react/keyboard-avoiding-view {:style styles/screen-container} [status-bar/status-bar] [toolbar/toolbar nil toolbar/default-nav-back @@ -62,7 +64,7 @@ [components.common/separator] [react/view styles/inputs-container [passphrase-input (or passphrase "") passphrase-error passphrase-warning] - [password-input (or password "") password-error]] + [password-input (or password "") password-error (when-not disabled? sign-in)]] [react/view components.styles/flex] (if processing [react/view styles/processing-view @@ -74,5 +76,5 @@ [components.common/bottom-button {:forward? true :label (i18n/label :t/sign-in) - :disabled? (or (not recovered-account) processing? (not valid-form?)) - :on-press #(re-frame/dispatch [:accounts.recover.ui/sign-in-button-pressed])}]])]))) + :disabled? disabled? + :on-press sign-in}]])])))