[#6122] prevent submitting of recovery phrase when it is empty

This commit is contained in:
Roman Volosovskyi 2018-10-06 08:23:24 +03:00
parent ccf037c167
commit 884bbbb813
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 8 additions and 6 deletions

View File

@ -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}]])])))