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
|
||||
(handlers/register-handler-fx
|
||||
:wallet/sign-message
|
||||
(fn [_ [_ typed? screen-params]]
|
||||
(fn [_ [_ typed? screen-params password-error-cb]]
|
||||
(let [{:keys [data from password]} screen-params]
|
||||
(if typed?
|
||||
{::sign-typed-data {:data data
|
||||
:password password
|
||||
: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
|
||||
:password (security/safe-unmask-data password)
|
||||
: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
|
||||
(handlers/register-handler-fx
|
||||
|
@ -116,14 +122,19 @@
|
|||
:amount amount-text
|
||||
:tx-hash result}]}))))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:show-sign-message-error
|
||||
(fn [[password-error-cb]]
|
||||
(password-error-cb)))
|
||||
|
||||
;; SIGN MESSAGE CALLBACK
|
||||
(handlers/register-handler-fx
|
||||
::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)]
|
||||
(if error
|
||||
;; ERROR
|
||||
(models.wallet/handle-transaction-error (assoc cofx :db db') error)
|
||||
{:show-sign-message-error [password-error-cb]}
|
||||
;; RESULT
|
||||
(if on-result
|
||||
{:dispatch (conj on-result id result method)})))))
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
opacity-value (animation/create-value 0)]
|
||||
{:component-did-mount #(send.animations/animate-sign-panel opacity-value 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])
|
||||
[react/animated-view {:style (styles/sign-panel opacity-value)}
|
||||
[react/view styles/spinner-container
|
||||
|
@ -104,7 +104,9 @@
|
|||
nil]]]]
|
||||
[enter-password-buttons value-atom false
|
||||
#(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]
|
||||
[password-input-panel value-atom :t/signing-message-phrase-description false]
|
||||
(when in-progress?
|
||||
|
|
Loading…
Reference in New Issue