mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-21 23:18:13 +00:00
pin: avoid changing PIN unnecessarily
This commit is contained in:
parent
456a2c68d6
commit
e60914e30f
@ -57,6 +57,8 @@ async def recovery_device(ctx, msg):
|
||||
# ask for pin repeatedly
|
||||
if msg.pin_protection:
|
||||
newpin = await request_pin_confirm(ctx, cancellable=False)
|
||||
else:
|
||||
newpin = ""
|
||||
|
||||
# dry run
|
||||
if msg.dry_run:
|
||||
@ -72,7 +74,7 @@ async def recovery_device(ctx, msg):
|
||||
)
|
||||
|
||||
# save into storage
|
||||
if msg.pin_protection:
|
||||
if newpin:
|
||||
config.change_pin(pin_to_int(""), pin_to_int(newpin))
|
||||
storage.set_u2f_counter(msg.u2f_counter)
|
||||
storage.load_settings(label=msg.label, use_passphrase=msg.passphrase_protection)
|
||||
|
@ -73,8 +73,9 @@ async def reset_device(ctx, msg):
|
||||
await show_wrong_entry(ctx)
|
||||
|
||||
# write PIN into storage
|
||||
if not config.change_pin(pin_to_int(""), pin_to_int(newpin)):
|
||||
raise wire.ProcessError("Could not change PIN")
|
||||
if newpin:
|
||||
if not config.change_pin(pin_to_int(""), pin_to_int(newpin)):
|
||||
raise wire.ProcessError("Could not change PIN")
|
||||
|
||||
# write settings and mnemonic into storage
|
||||
storage.load_settings(label=msg.label, use_passphrase=msg.passphrase_protection)
|
||||
|
2
vendor/trezor-storage
vendored
2
vendor/trezor-storage
vendored
@ -1 +1 @@
|
||||
Subproject commit 0e897f673a2150607bae553e21604b253352644e
|
||||
Subproject commit 511fc205b284605651348512c5c5c2c95a642fa1
|
Loading…
Reference in New Issue
Block a user