1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 03:18:09 +00:00

pin: do not allow the user to enter an empty PIN

An empty PIN is used to signify PIN removal and T1 does not allow entering an empty PIN neither via web-wallet nor via trezorctl.
This commit is contained in:
Andrew Kozlik 2019-02-23 12:19:08 +01:00 committed by Pavol Rusnak
parent e60914e30f
commit edae40e22c
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 16 additions and 0 deletions

View File

@ -36,6 +36,17 @@ async def request_pin(
c.taint()
c.render()
c = dialog.confirm
if matrix.pin:
if not c.is_enabled():
c.enable()
c.taint()
else:
if c.is_enabled():
c.disable()
c.taint()
c.render()
if label is None:
label = "Enter your PIN"
sublabel = None
@ -59,6 +70,8 @@ async def request_pin(
else:
result = await dialog
if result == CONFIRMED:
if not matrix.pin:
continue
return matrix.pin
elif matrix.pin: # reset
matrix.change("")

View File

@ -36,6 +36,9 @@ class Button(Widget):
self.state = BTN_DISABLED
self.tainted = True
def is_enabled(self):
return self.state != BTN_DISABLED
def render(self):
if not self.tainted:
return