1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

apps/management/reset_device: fix change_pin

This commit is contained in:
Jan Pochyla 2018-02-05 15:13:33 +01:00
parent f56aaa3b1c
commit 58f48f8ade
2 changed files with 7 additions and 4 deletions

View File

@ -7,6 +7,7 @@ from trezor.messages import ButtonRequestType, FailureType, wire_types
from trezor.messages.ButtonRequest import ButtonRequest
from trezor.messages.EntropyRequest import EntropyRequest
from trezor.messages.Success import Success
from trezor.pin import pin_to_int
from trezor.ui.confirm import HoldToConfirmDialog
from trezor.ui.keyboard import MnemonicKeyboard
from trezor.ui.scroll import Scrollpage, animate_swipe, paginate
@ -68,7 +69,7 @@ async def reset_device(ctx, msg):
await show_wrong_entry(ctx)
# write PIN into storage
if not config.change_pin('', newpin):
if not config.change_pin(pin_to_int(''), pin_to_int(newpin), None):
raise wire.FailureError(
FailureType.ProcessError, 'Could not change PIN')

View File

@ -1,9 +1,11 @@
def pin_to_int(pin):
from trezor import ui
def pin_to_int(pin: str) -> int:
return int('1' + pin)
def show_pin_timeout(wait, total):
from trezor import ui
def show_pin_timeout(wait: int, total: int):
ui.display.bar(0, 0, ui.SCREEN, ui.SCREEN, ui.BG)
ui.display.loader(1000 - (1000 * wait // total), -10, ui.FG, ui.BG)
ui.display.text_center(ui.SCREEN // 2, ui.SCREEN - 20, 'Waiting for %d s' % wait, ui.BOLD, ui.FG, ui.BG)