mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +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():
|
||||
c = dialog.cancel
|
||||
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:
|
||||
c.normal_style = ui.BTN_CANCEL['normal']
|
||||
c.content = res.load(ui.ICON_LOCK)
|
||||
c.taint()
|
||||
c.render()
|
||||
|
Binary file not shown.
@ -67,5 +67,10 @@ class PinMatrix(ui.Widget):
|
||||
|
||||
def change(self, pin):
|
||||
self.pin = pin
|
||||
for btn in self.pin_buttons:
|
||||
if len(self.pin) == self.maxlength:
|
||||
btn.disable()
|
||||
else:
|
||||
btn.enable()
|
||||
if self.onchange:
|
||||
self.onchange()
|
||||
|
Loading…
Reference in New Issue
Block a user