1
0

hw: fix passphrase dialog with confirmation

closes #4876
This commit is contained in:
SomberNight
2018-11-28 20:54:57 +01:00
parent 505cb2f65d
commit d0e6b8c89d
3 changed files with 20 additions and 15 deletions

View File

@@ -27,7 +27,8 @@
import threading
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.i18n import _
@@ -114,11 +115,16 @@ class QtHandlerBase(QObject, PrintError):
def passphrase_dialog(self, msg, confirm):
# If confirm is true, require the user to enter the passphrase twice
parent = self.top_level_window()
d = WindowModalDialog(parent, _("Enter Passphrase"))
if confirm:
d = PasswordDialog(parent, None, msg, PW_PASSPHRASE)
confirmed, p, passphrase = d.run()
OK_button = OkButton(d)
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:
d = WindowModalDialog(parent, _("Enter Passphrase"))
pw = QLineEdit()
pw.setEchoMode(2)
pw.setMinimumWidth(200)