bug #7724 - correctly showing password errors for sign message
Signed-off-by: Goran Jovic <goranjovic@gmail.com>
This commit is contained in:
parent
670deb1f4c
commit
dccc81db7b
|
@ -80,17 +80,23 @@
|
||||||
;; SIGN MESSAGE
|
;; SIGN MESSAGE
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:wallet/sign-message
|
:wallet/sign-message
|
||||||
(fn [_ [_ typed? screen-params]]
|
(fn [_ [_ typed? screen-params password-error-cb]]
|
||||||
(let [{:keys [data from password]} screen-params]
|
(let [{:keys [data from password]} screen-params]
|
||||||
(if typed?
|
(if typed?
|
||||||
{::sign-typed-data {:data data
|
{::sign-typed-data {:data data
|
||||||
:password password
|
:password password
|
||||||
:account from
|
:account from
|
||||||
:on-completed #(re-frame/dispatch [::sign-message-completed screen-params (types/json->clj %)])}}
|
:on-completed #(re-frame/dispatch [::sign-message-completed
|
||||||
|
screen-params
|
||||||
|
(types/json->clj %)
|
||||||
|
password-error-cb])}}
|
||||||
{::sign-message {:params {:data data
|
{::sign-message {:params {:data data
|
||||||
:password (security/safe-unmask-data password)
|
:password (security/safe-unmask-data password)
|
||||||
:account from}
|
:account from}
|
||||||
:on-completed #(re-frame/dispatch [::sign-message-completed screen-params (types/json->clj %)])}}))))
|
:on-completed #(re-frame/dispatch [::sign-message-completed
|
||||||
|
screen-params
|
||||||
|
(types/json->clj %)
|
||||||
|
password-error-cb])}}))))
|
||||||
|
|
||||||
;; SEND TRANSACTION CALLBACK
|
;; SEND TRANSACTION CALLBACK
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
|
@ -116,14 +122,19 @@
|
||||||
:amount amount-text
|
:amount amount-text
|
||||||
:tx-hash result}]}))))))
|
:tx-hash result}]}))))))
|
||||||
|
|
||||||
|
(re-frame/reg-fx
|
||||||
|
:show-sign-message-error
|
||||||
|
(fn [[password-error-cb]]
|
||||||
|
(password-error-cb)))
|
||||||
|
|
||||||
;; SIGN MESSAGE CALLBACK
|
;; SIGN MESSAGE CALLBACK
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
::sign-message-completed
|
::sign-message-completed
|
||||||
(fn [{:keys [db now] :as cofx} [_ {:keys [on-result id method]} {:keys [result error]}]]
|
(fn [{:keys [db now] :as cofx} [_ {:keys [on-result id method]} {:keys [result error]} password-error-cb]]
|
||||||
(let [db' (assoc-in db [:wallet :send-transaction :in-progress?] false)]
|
(let [db' (assoc-in db [:wallet :send-transaction :in-progress?] false)]
|
||||||
(if error
|
(if error
|
||||||
;; ERROR
|
;; ERROR
|
||||||
(models.wallet/handle-transaction-error (assoc cofx :db db') error)
|
{:show-sign-message-error [password-error-cb]}
|
||||||
;; RESULT
|
;; RESULT
|
||||||
(if on-result
|
(if on-result
|
||||||
{:dispatch (conj on-result id result method)})))))
|
{:dispatch (conj on-result id result method)})))))
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
opacity-value (animation/create-value 0)]
|
opacity-value (animation/create-value 0)]
|
||||||
{:component-did-mount #(send.animations/animate-sign-panel opacity-value bottom-value)}
|
{:component-did-mount #(send.animations/animate-sign-panel opacity-value bottom-value)}
|
||||||
[react/animated-view {:style (styles/animated-sign-panel bottom-value)}
|
[react/animated-view {:style (styles/animated-sign-panel bottom-value)}
|
||||||
(when (:wrong-password? value-atom)
|
(when (:wrong-password? @value-atom)
|
||||||
[tooltip/tooltip (i18n/label :t/wrong-password) styles/password-error-tooltip])
|
[tooltip/tooltip (i18n/label :t/wrong-password) styles/password-error-tooltip])
|
||||||
[react/animated-view {:style (styles/sign-panel opacity-value)}
|
[react/animated-view {:style (styles/sign-panel opacity-value)}
|
||||||
[react/view styles/spinner-container
|
[react/view styles/spinner-container
|
||||||
|
@ -104,7 +104,9 @@
|
||||||
nil]]]]
|
nil]]]]
|
||||||
[enter-password-buttons value-atom false
|
[enter-password-buttons value-atom false
|
||||||
#(re-frame/dispatch [:wallet/discard-transaction-navigate-back])
|
#(re-frame/dispatch [:wallet/discard-transaction-navigate-back])
|
||||||
#(re-frame/dispatch [:wallet/sign-message typed? (merge screen-params @value-atom)])
|
#(re-frame/dispatch [:wallet/sign-message typed? (merge screen-params @value-atom)
|
||||||
|
(fn []
|
||||||
|
(swap! value-atom assoc :wrong-password? true))])
|
||||||
:t/transactions-sign]
|
:t/transactions-sign]
|
||||||
[password-input-panel value-atom :t/signing-message-phrase-description false]
|
[password-input-panel value-atom :t/signing-message-phrase-description false]
|
||||||
(when in-progress?
|
(when in-progress?
|
||||||
|
|
Loading…
Reference in New Issue