mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-05 13:01:12 +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.taint()
|
||||||
c.render()
|
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:
|
if label is None:
|
||||||
label = "Enter your PIN"
|
label = "Enter your PIN"
|
||||||
sublabel = None
|
sublabel = None
|
||||||
@ -59,6 +70,8 @@ async def request_pin(
|
|||||||
else:
|
else:
|
||||||
result = await dialog
|
result = await dialog
|
||||||
if result == CONFIRMED:
|
if result == CONFIRMED:
|
||||||
|
if not matrix.pin:
|
||||||
|
continue
|
||||||
return matrix.pin
|
return matrix.pin
|
||||||
elif matrix.pin: # reset
|
elif matrix.pin: # reset
|
||||||
matrix.change("")
|
matrix.change("")
|
||||||
|
@ -36,6 +36,9 @@ class Button(Widget):
|
|||||||
self.state = BTN_DISABLED
|
self.state = BTN_DISABLED
|
||||||
self.tainted = True
|
self.tainted = True
|
||||||
|
|
||||||
|
def is_enabled(self):
|
||||||
|
return self.state != BTN_DISABLED
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
if not self.tainted:
|
if not self.tainted:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user