trezor pin dialog: only show PIN "strength" when creating/changing
fixes #4832
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import time
|
||||
from struct import pack
|
||||
from typing import Optional
|
||||
|
||||
from electrum import ecc
|
||||
from electrum.i18n import _
|
||||
@@ -7,11 +8,12 @@ from electrum.util import UserCancelled
|
||||
from electrum.keystore import bip39_normalize_passphrase
|
||||
from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32
|
||||
from electrum.logging import Logger
|
||||
from electrum.plugins.hw_wallet.plugin import HardwareClientBase
|
||||
from electrum.plugins.hw_wallet.plugin import HardwareClientBase, HardwareHandlerBase
|
||||
|
||||
|
||||
class GuiMixin(object):
|
||||
# Requires: self.proto, self.device
|
||||
handler: Optional[HardwareHandlerBase]
|
||||
|
||||
messages = {
|
||||
3: _("Confirm the transaction output on your {} device"),
|
||||
@@ -45,6 +47,7 @@ class GuiMixin(object):
|
||||
return self.proto.ButtonAck()
|
||||
|
||||
def callback_PinMatrixRequest(self, msg):
|
||||
show_strength = True
|
||||
if msg.type == 2:
|
||||
msg = _("Enter a new PIN for your {}:")
|
||||
elif msg.type == 3:
|
||||
@@ -52,7 +55,8 @@ class GuiMixin(object):
|
||||
"NOTE: the positions of the numbers have changed!"))
|
||||
else:
|
||||
msg = _("Enter your current {} PIN:")
|
||||
pin = self.handler.get_pin(msg.format(self.device))
|
||||
show_strength = False
|
||||
pin = self.handler.get_pin(msg.format(self.device), show_strength=show_strength)
|
||||
if len(pin) > 9:
|
||||
self.handler.show_error(_('The PIN cannot be longer than 9 characters.'))
|
||||
pin = '' # to cancel below
|
||||
|
||||
Reference in New Issue
Block a user