mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
parent
505cb2f65d
commit
d0e6b8c89d
3 changed files with 20 additions and 15 deletions
|
@ -432,7 +432,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
return slayout.is_ext
|
return slayout.is_ext
|
||||||
|
|
||||||
def pw_layout(self, msg, kind, force_disable_encrypt_cb):
|
def pw_layout(self, msg, kind, force_disable_encrypt_cb):
|
||||||
playout = PasswordLayout(None, msg, kind, self.next_button,
|
playout = PasswordLayout(msg=msg, kind=kind, OK_button=self.next_button,
|
||||||
force_disable_encrypt_cb=force_disable_encrypt_cb)
|
force_disable_encrypt_cb=force_disable_encrypt_cb)
|
||||||
playout.encrypt_cb.setChecked(True)
|
playout.encrypt_cb.setChecked(True)
|
||||||
self.exec_layout(playout.layout())
|
self.exec_layout(playout.layout())
|
||||||
|
@ -446,7 +446,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||||
|
|
||||||
@wizard_dialog
|
@wizard_dialog
|
||||||
def request_storage_encryption(self, run_next):
|
def request_storage_encryption(self, run_next):
|
||||||
playout = PasswordLayoutForHW(None, MSG_HW_STORAGE_ENCRYPTION, PW_NEW, self.next_button)
|
playout = PasswordLayoutForHW(MSG_HW_STORAGE_ENCRYPTION)
|
||||||
playout.encrypt_cb.setChecked(True)
|
playout.encrypt_cb.setChecked(True)
|
||||||
self.exec_layout(playout.layout())
|
self.exec_layout(playout.layout())
|
||||||
return playout.encrypt_cb.isChecked()
|
return playout.encrypt_cb.isChecked()
|
||||||
|
|
|
@ -60,7 +60,7 @@ class PasswordLayout(object):
|
||||||
|
|
||||||
titles = [_("Enter Password"), _("Change Password"), _("Enter Passphrase")]
|
titles = [_("Enter Password"), _("Change Password"), _("Enter Passphrase")]
|
||||||
|
|
||||||
def __init__(self, wallet, msg, kind, OK_button, force_disable_encrypt_cb=False):
|
def __init__(self, msg, kind, OK_button, wallet=None, force_disable_encrypt_cb=False):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
|
||||||
self.pw = QLineEdit()
|
self.pw = QLineEdit()
|
||||||
|
@ -169,12 +169,9 @@ class PasswordLayout(object):
|
||||||
|
|
||||||
class PasswordLayoutForHW(object):
|
class PasswordLayoutForHW(object):
|
||||||
|
|
||||||
def __init__(self, wallet, msg, kind, OK_button):
|
def __init__(self, msg, wallet=None):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
|
||||||
self.kind = kind
|
|
||||||
self.OK_button = OK_button
|
|
||||||
|
|
||||||
vbox = QVBoxLayout()
|
vbox = QVBoxLayout()
|
||||||
label = QLabel(msg + "\n")
|
label = QLabel(msg + "\n")
|
||||||
label.setWordWrap(True)
|
label.setWordWrap(True)
|
||||||
|
@ -254,9 +251,11 @@ class ChangePasswordDialogForSW(ChangePasswordDialogBase):
|
||||||
else:
|
else:
|
||||||
msg = _('Your wallet is password protected and encrypted.')
|
msg = _('Your wallet is password protected and encrypted.')
|
||||||
msg += ' ' + _('Use this dialog to change your password.')
|
msg += ' ' + _('Use this dialog to change your password.')
|
||||||
self.playout = PasswordLayout(
|
self.playout = PasswordLayout(msg=msg,
|
||||||
wallet, msg, PW_CHANGE, OK_button,
|
kind=PW_CHANGE,
|
||||||
force_disable_encrypt_cb=not wallet.can_have_keystore_encryption())
|
OK_button=OK_button,
|
||||||
|
wallet=wallet,
|
||||||
|
force_disable_encrypt_cb=not wallet.can_have_keystore_encryption())
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.exec_():
|
if not self.exec_():
|
||||||
|
@ -276,7 +275,7 @@ class ChangePasswordDialogForHW(ChangePasswordDialogBase):
|
||||||
msg = _('Your wallet file is encrypted.')
|
msg = _('Your wallet file is encrypted.')
|
||||||
msg += '\n' + _('Note: If you enable this setting, you will need your hardware device to open your wallet.')
|
msg += '\n' + _('Note: If you enable this setting, you will need your hardware device to open your wallet.')
|
||||||
msg += '\n' + _('Use this dialog to toggle encryption.')
|
msg += '\n' + _('Use this dialog to toggle encryption.')
|
||||||
self.playout = PasswordLayoutForHW(wallet, msg, PW_CHANGE, OK_button)
|
self.playout = PasswordLayoutForHW(msg)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.exec_():
|
if not self.exec_():
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from PyQt5.Qt import QVBoxLayout, QLabel
|
from PyQt5.Qt import QVBoxLayout, QLabel
|
||||||
from electrum.gui.qt.password_dialog import PasswordDialog, PW_PASSPHRASE
|
|
||||||
|
from electrum.gui.qt.password_dialog import PasswordLayout, PW_PASSPHRASE
|
||||||
from electrum.gui.qt.util import *
|
from electrum.gui.qt.util import *
|
||||||
|
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
|
@ -114,11 +115,16 @@ class QtHandlerBase(QObject, PrintError):
|
||||||
def passphrase_dialog(self, msg, confirm):
|
def passphrase_dialog(self, msg, confirm):
|
||||||
# If confirm is true, require the user to enter the passphrase twice
|
# If confirm is true, require the user to enter the passphrase twice
|
||||||
parent = self.top_level_window()
|
parent = self.top_level_window()
|
||||||
|
d = WindowModalDialog(parent, _("Enter Passphrase"))
|
||||||
if confirm:
|
if confirm:
|
||||||
d = PasswordDialog(parent, None, msg, PW_PASSPHRASE)
|
OK_button = OkButton(d)
|
||||||
confirmed, p, passphrase = d.run()
|
playout = PasswordLayout(msg=msg, kind=PW_PASSPHRASE, OK_button=OK_button)
|
||||||
|
vbox = QVBoxLayout()
|
||||||
|
vbox.addLayout(playout.layout())
|
||||||
|
vbox.addLayout(Buttons(CancelButton(d), OK_button))
|
||||||
|
d.setLayout(vbox)
|
||||||
|
passphrase = playout.new_password() if d.exec_() else None
|
||||||
else:
|
else:
|
||||||
d = WindowModalDialog(parent, _("Enter Passphrase"))
|
|
||||||
pw = QLineEdit()
|
pw = QLineEdit()
|
||||||
pw.setEchoMode(2)
|
pw.setEchoMode(2)
|
||||||
pw.setMinimumWidth(200)
|
pw.setMinimumWidth(200)
|
||||||
|
|
Loading…
Add table
Reference in a new issue