diff --git a/src/apps/management/reset_device.py b/src/apps/management/reset_device.py index b56dd2b511..d2687f4819 100644 --- a/src/apps/management/reset_device.py +++ b/src/apps/management/reset_device.py @@ -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') diff --git a/src/trezor/pin.py b/src/trezor/pin.py index 7ed7970f23..2b9752a8a1 100644 --- a/src/trezor/pin.py +++ b/src/trezor/pin.py @@ -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)