1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

ui/pin: check maxlength

This commit is contained in:
Peter Jensen 2018-02-05 14:26:12 +01:00 committed by Jan Pochyla
parent 9c84b742a0
commit f56aaa3b1c
4 changed files with 8 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -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.

View File

@ -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()