[#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
{:events [:hardwallet/verify-pin]}
[{:keys [db] :as cofx} {:keys [pin-step on-card-connected on-failure on-success]}]
(fx/merge
cofx
{:db (update-in db [:hardwallet :pin] assoc
:on-verified on-success
:on-verified-failure on-failure)}
(show-connection-sheet
{:on-card-connected (or on-card-connected :hardwallet/verify-pin)
:handler
(fn [{:keys [db] :as cofx}]
(let [pin (vector->string (get-in db [:hardwallet :pin pin-step]))
pairing (get-pairing db)]
(fx/merge
cofx
{:db (assoc-in db [:hardwallet :pin :status] :verifying)
:hardwallet/verify-pin {:pin pin
:pairing pairing}})))})))
(let [on-success (or on-success
(get-in db [:hardwallet :pin :on-verified]))
on-failure (or on-failure
(get-in db [:hardwallet :pin :on-verified-failure]))]
(fx/merge
cofx
{:db (update-in db [:hardwallet :pin] assoc
:on-verified on-success
:on-verified-failure on-failure)}
(show-connection-sheet
{:on-card-connected (or on-card-connected :hardwallet/verify-pin)
:handler
(fn [{:keys [db] :as cofx}]
(let [pin (vector->string (get-in db [:hardwallet :pin pin-step]))
pairing (get-pairing db)]
(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])
numbers-entered (count pin)]
(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)}
(and (= enter-step :login)
@ -309,7 +310,7 @@
(and (= enter-step :current)
(= pin-code-length numbers-entered))
(common/verify-pin :current)
(common/verify-pin {:pin-step :current})
(and (= enter-step :export-key)
(= pin-code-length numbers-entered))

View File

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