mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 15:38:11 +00:00
ui/pin: check maxlength
This commit is contained in:
parent
9c84b742a0
commit
f56aaa3b1c
BIN
assets/lock.png
BIN
assets/lock.png
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -16,8 +16,10 @@ async def request_pin(code: int = None) -> str:
|
|||||||
def onchange():
|
def onchange():
|
||||||
c = dialog.cancel
|
c = dialog.cancel
|
||||||
if matrix.pin:
|
if matrix.pin:
|
||||||
c.content = res.load(ui.ICON_CLEAR)
|
c.normal_style = ui.BTN_CLEAR['normal']
|
||||||
|
c.content = res.load(ui.ICON_BACK)
|
||||||
else:
|
else:
|
||||||
|
c.normal_style = ui.BTN_CANCEL['normal']
|
||||||
c.content = res.load(ui.ICON_LOCK)
|
c.content = res.load(ui.ICON_LOCK)
|
||||||
c.taint()
|
c.taint()
|
||||||
c.render()
|
c.render()
|
||||||
|
Binary file not shown.
@ -67,5 +67,10 @@ class PinMatrix(ui.Widget):
|
|||||||
|
|
||||||
def change(self, pin):
|
def change(self, pin):
|
||||||
self.pin = pin
|
self.pin = pin
|
||||||
|
for btn in self.pin_buttons:
|
||||||
|
if len(self.pin) == self.maxlength:
|
||||||
|
btn.disable()
|
||||||
|
else:
|
||||||
|
btn.enable()
|
||||||
if self.onchange:
|
if self.onchange:
|
||||||
self.onchange()
|
self.onchange()
|
||||||
|
Loading…
Reference in New Issue
Block a user