fix #4122
This commit is contained in:
7
electrum
7
electrum
@@ -93,7 +93,7 @@ from electrum import constants
|
|||||||
from electrum import SimpleConfig, Network
|
from electrum import SimpleConfig, Network
|
||||||
from electrum.wallet import Wallet, Imported_Wallet
|
from electrum.wallet import Wallet, Imported_Wallet
|
||||||
from electrum.storage import WalletStorage, get_derivation_used_for_hw_device_encryption
|
from electrum.storage import WalletStorage, get_derivation_used_for_hw_device_encryption
|
||||||
from electrum.util import print_msg, print_stderr, json_encode, json_decode
|
from electrum.util import print_msg, print_stderr, json_encode, json_decode, UserCancelled
|
||||||
from electrum.util import set_verbosity, InvalidPassword
|
from electrum.util import set_verbosity, InvalidPassword
|
||||||
from electrum.commands import get_parser, known_commands, Commands, config_variables
|
from electrum.commands import get_parser, known_commands, Commands, config_variables
|
||||||
from electrum import daemon
|
from electrum import daemon
|
||||||
@@ -295,7 +295,10 @@ def get_password_for_hw_device_encrypted_storage(plugins):
|
|||||||
name, device_info = devices[0]
|
name, device_info = devices[0]
|
||||||
plugin = plugins.get_plugin(name)
|
plugin = plugins.get_plugin(name)
|
||||||
derivation = get_derivation_used_for_hw_device_encryption()
|
derivation = get_derivation_used_for_hw_device_encryption()
|
||||||
xpub = plugin.get_xpub(device_info.device.id_, derivation, 'standard', plugin.handler)
|
try:
|
||||||
|
xpub = plugin.get_xpub(device_info.device.id_, derivation, 'standard', plugin.handler)
|
||||||
|
except UserCancelled:
|
||||||
|
sys.exit(0)
|
||||||
password = keystore.Xpub.get_pubkey_from_xpub(xpub, ())
|
password = keystore.Xpub.get_pubkey_from_xpub(xpub, ())
|
||||||
return password
|
return password
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ class CmdLineHandler:
|
|||||||
def show_message(self, msg, on_cancel=None):
|
def show_message(self, msg, on_cancel=None):
|
||||||
print_msg(msg)
|
print_msg(msg)
|
||||||
|
|
||||||
|
def show_error(self, msg):
|
||||||
|
print_msg(msg)
|
||||||
|
|
||||||
def update_status(self, b):
|
def update_status(self, b):
|
||||||
print_error('trezor status', b)
|
print_error('trezor status', b)
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ class GuiMixin(object):
|
|||||||
else:
|
else:
|
||||||
msg = _("Enter your current {} PIN:")
|
msg = _("Enter your current {} PIN:")
|
||||||
pin = self.handler.get_pin(msg.format(self.device))
|
pin = self.handler.get_pin(msg.format(self.device))
|
||||||
|
if len(pin) > 9:
|
||||||
|
self.handler.show_error(_('The PIN cannot be longer than 9 characters.'))
|
||||||
|
pin = '' # to cancel below
|
||||||
if not pin:
|
if not pin:
|
||||||
return self.proto.Cancel()
|
return self.proto.Cancel()
|
||||||
return self.proto.PinMatrixAck(pin=pin)
|
return self.proto.PinMatrixAck(pin=pin)
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ class QtPlugin(QtPluginBase):
|
|||||||
vbox.addWidget(QLabel(msg))
|
vbox.addWidget(QLabel(msg))
|
||||||
vbox.addWidget(text)
|
vbox.addWidget(text)
|
||||||
pin = QLineEdit()
|
pin = QLineEdit()
|
||||||
pin.setValidator(QRegExpValidator(QRegExp('[1-9]{0,10}')))
|
pin.setValidator(QRegExpValidator(QRegExp('[1-9]{0,9}')))
|
||||||
pin.setMaximumWidth(100)
|
pin.setMaximumWidth(100)
|
||||||
hbox_pin = QHBoxLayout()
|
hbox_pin = QHBoxLayout()
|
||||||
hbox_pin.addWidget(QLabel(_("Enter your PIN (digits 1-9):")))
|
hbox_pin.addWidget(QLabel(_("Enter your PIN (digits 1-9):")))
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ class GuiMixin(object):
|
|||||||
else:
|
else:
|
||||||
msg = _("Enter your current {} PIN:")
|
msg = _("Enter your current {} PIN:")
|
||||||
pin = self.handler.get_pin(msg.format(self.device))
|
pin = self.handler.get_pin(msg.format(self.device))
|
||||||
|
if len(pin) > 9:
|
||||||
|
self.handler.show_error(_('The PIN cannot be longer than 9 characters.'))
|
||||||
|
pin = '' # to cancel below
|
||||||
if not pin:
|
if not pin:
|
||||||
return self.proto.Cancel()
|
return self.proto.Cancel()
|
||||||
return self.proto.PinMatrixAck(pin=pin)
|
return self.proto.PinMatrixAck(pin=pin)
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ class QtPlugin(QtPluginBase):
|
|||||||
vbox.addWidget(QLabel(msg))
|
vbox.addWidget(QLabel(msg))
|
||||||
vbox.addWidget(text)
|
vbox.addWidget(text)
|
||||||
pin = QLineEdit()
|
pin = QLineEdit()
|
||||||
pin.setValidator(QRegExpValidator(QRegExp('[1-9]{0,10}')))
|
pin.setValidator(QRegExpValidator(QRegExp('[1-9]{0,9}')))
|
||||||
pin.setMaximumWidth(100)
|
pin.setMaximumWidth(100)
|
||||||
hbox_pin = QHBoxLayout()
|
hbox_pin = QHBoxLayout()
|
||||||
hbox_pin.addWidget(QLabel(_("Enter your PIN (digits 1-9):")))
|
hbox_pin.addWidget(QLabel(_("Enter your PIN (digits 1-9):")))
|
||||||
|
|||||||
Reference in New Issue
Block a user