[#10275] Can't finish card setup if creating card flow is canceled on PUK / Pairing code screen

This commit is contained in:
Roman Volosovskyi 2020-04-09 16:59:27 +03:00
parent 8b4bc0290a
commit 8b9a245f54
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
3 changed files with 23 additions and 19 deletions

View File

@ -468,19 +468,23 @@
(fx/defn verify-pin (fx/defn verify-pin
{:events [:hardwallet/verify-pin]} {:events [:hardwallet/verify-pin]}
[{:keys [db] :as cofx} {:keys [pin-step on-card-connected on-failure on-success]}] [{:keys [db] :as cofx} {:keys [pin-step on-card-connected on-failure on-success]}]
(fx/merge (let [on-success (or on-success
cofx (get-in db [:hardwallet :pin :on-verified]))
{:db (update-in db [:hardwallet :pin] assoc on-failure (or on-failure
:on-verified on-success (get-in db [:hardwallet :pin :on-verified-failure]))]
:on-verified-failure on-failure)} (fx/merge
(show-connection-sheet cofx
{:on-card-connected (or on-card-connected :hardwallet/verify-pin) {:db (update-in db [:hardwallet :pin] assoc
:handler :on-verified on-success
(fn [{:keys [db] :as cofx}] :on-verified-failure on-failure)}
(let [pin (vector->string (get-in db [:hardwallet :pin pin-step])) (show-connection-sheet
pairing (get-pairing db)] {:on-card-connected (or on-card-connected :hardwallet/verify-pin)
(fx/merge :handler
cofx (fn [{:keys [db] :as cofx}]
{:db (assoc-in db [:hardwallet :pin :status] :verifying) (let [pin (vector->string (get-in db [:hardwallet :pin pin-step]))
:hardwallet/verify-pin {:pin pin pairing (get-pairing db)]
:pairing pairing}})))}))) (fx/merge
cofx
{:db (assoc-in db [:hardwallet :pin :status] :verifying)
:hardwallet/verify-pin {:pin pin
:pairing pairing}})))}))))

View File

@ -287,7 +287,8 @@
pin (get-in db [:hardwallet :pin enter-step]) pin (get-in db [:hardwallet :pin enter-step])
numbers-entered (count pin)] numbers-entered (count pin)]
(log/debug "[hardwallet] process-pin-input" (log/debug "[hardwallet] process-pin-input"
"enter-step" enter-step) "enter-step" enter-step
"numbers-entered" numbers-entered)
(cond-> {:db (assoc-in db [:hardwallet :pin :status] nil)} (cond-> {:db (assoc-in db [:hardwallet :pin :status] nil)}
(and (= enter-step :login) (and (= enter-step :login)
@ -309,7 +310,7 @@
(and (= enter-step :current) (and (= enter-step :current)
(= pin-code-length numbers-entered)) (= pin-code-length numbers-entered))
(common/verify-pin :current) (common/verify-pin {:pin-step :current})
(and (= enter-step :export-key) (and (= enter-step :export-key)
(= pin-code-length numbers-entered)) (= pin-code-length numbers-entered))

View File

@ -237,7 +237,6 @@
enter-step [:hardwallet/pin-enter-step] enter-step [:hardwallet/pin-enter-step]
status [:hardwallet/pin-status] status [:hardwallet/pin-status]
error-label [:hardwallet/pin-error-label] error-label [:hardwallet/pin-error-label]
multiple-multiaccounts? [:multiple-multiaccounts?]
{:keys [key-uid name] :as account} [:multiaccounts/login] {:keys [key-uid name] :as account} [:multiaccounts/login]
small-screen? [:dimensions/small-screen?] small-screen? [:dimensions/small-screen?]
retry-counter [:hardwallet/retry-counter]] retry-counter [:hardwallet/retry-counter]]