[#6122] prevent submitting of recovery phrase when it is empty
This commit is contained in:
parent
ccf037c167
commit
884bbbb813
|
@ -36,7 +36,7 @@
|
||||||
:error (cond error (i18n/label error)
|
:error (cond error (i18n/label error)
|
||||||
warning (i18n/label warning))}]))
|
warning (i18n/label warning))}]))
|
||||||
|
|
||||||
(defview password-input [password error]
|
(defview password-input [password error on-submit-editing]
|
||||||
[react/view {:style styles/password-input
|
[react/view {:style styles/password-input
|
||||||
:important-for-accessibility :no-hide-descendants}
|
:important-for-accessibility :no-hide-descendants}
|
||||||
[text-input/text-input-with-label
|
[text-input/text-input-with-label
|
||||||
|
@ -48,13 +48,15 @@
|
||||||
:on-blur #(re-frame/dispatch [:accounts.recover.ui/password-input-blured])
|
:on-blur #(re-frame/dispatch [:accounts.recover.ui/password-input-blured])
|
||||||
:secure-text-entry true
|
:secure-text-entry true
|
||||||
:error (when error (i18n/label error))
|
: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 []
|
(defview recover []
|
||||||
(letsubs [recovered-account [:get-recover-account]]
|
(letsubs [recovered-account [:get-recover-account]]
|
||||||
(let [{:keys [passphrase password processing passphrase-valid? password-valid?
|
(let [{:keys [passphrase password processing passphrase-valid? password-valid?
|
||||||
password-error passphrase-error passphrase-warning processing?]} recovered-account
|
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}
|
[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
|
||||||
|
@ -62,7 +64,7 @@
|
||||||
[components.common/separator]
|
[components.common/separator]
|
||||||
[react/view styles/inputs-container
|
[react/view styles/inputs-container
|
||||||
[passphrase-input (or passphrase "") passphrase-error passphrase-warning]
|
[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]
|
[react/view components.styles/flex]
|
||||||
(if processing
|
(if processing
|
||||||
[react/view styles/processing-view
|
[react/view styles/processing-view
|
||||||
|
@ -74,5 +76,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 (not recovered-account) processing? (not valid-form?))
|
:disabled? disabled?
|
||||||
:on-press #(re-frame/dispatch [:accounts.recover.ui/sign-in-button-pressed])}]])])))
|
:on-press sign-in}]])])))
|
||||||
|
|
Loading…
Reference in New Issue