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:
parent
e60914e30f
commit
edae40e22c
@ -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("")
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user