commit f98d1f43b474b19a64a06cc9a3bbcf0666347dfa
parent 6c1dae4b1040ad96613a7dd55f8be0ca151b94d4
Author: ThomasV <thomasv@electrum.org>
Date: Sun, 28 Aug 2016 10:33:01 +0200
do not propose passphrase option in 2fa wallets
Diffstat:
3 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py
@@ -260,24 +260,28 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
seed = slayout.sanitized_text()
return seed
- def seed_input(self, title, message, is_valid, bip39=False):
+ def seed_input(self, title, message, is_valid):
slayout = self.text_input_layout(title, message, is_valid)
vbox = QVBoxLayout()
vbox.addLayout(slayout.layout())
- cb_passphrase = QCheckBox(_('Add a passphrase to this seed'))
- vbox.addWidget(cb_passphrase)
- cb_bip39 = QCheckBox(_('BIP39/BIP44 seed'))
- cb_bip39.setVisible(bip39)
- vbox.addWidget(cb_bip39)
- def f(b):
- slayout.is_valid = (lambda x: bool(x)) if b else is_valid
- slayout.set_enabled()
- cb_bip39.toggled.connect(f)
+ if self.opt_ext or self.opt_bip39:
+ vbox.addStretch(1)
+ vbox.addWidget(QLabel(_('Options')+ ':'))
+ if self.opt_ext:
+ cb_ext = QCheckBox(_('Extend this seed with a passphrase'))
+ vbox.addWidget(cb_ext)
+ if self.opt_bip39:
+ def f(b):
+ slayout.is_valid = (lambda x: bool(x)) if b else is_valid
+ slayout.set_enabled()
+ cb_bip39 = QCheckBox(_('BIP39/BIP44 seed'))
+ cb_bip39.toggled.connect(f)
+ vbox.addWidget(cb_bip39)
self.set_main_layout(vbox, title, next_enabled=False)
seed = slayout.sanitized_text()
- add_passphrase = cb_passphrase.isChecked()
- is_bip39 = cb_bip39.isChecked()
- return seed, add_passphrase, is_bip39
+ is_ext = cb_ext.isChecked() if self.opt_ext else False
+ is_bip39 = cb_bip39.isChecked() if self.opt_bip39 else False
+ return seed, is_ext, is_bip39
@wizard_dialog
def restore_keys_dialog(self, title, message, is_valid, run_next):
@@ -296,14 +300,15 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
def restore_seed_dialog(self, run_next, is_valid):
title = _('Enter Seed')
message = _('Please enter your seed phrase in order to restore your wallet.')
- return self.seed_input(title, message, is_valid, bip39=True)
+ return self.seed_input(title, message, is_valid)
@wizard_dialog
def confirm_seed_dialog(self, run_next, is_valid):
self.app.clipboard().clear()
title = _('Confirm Seed')
message = ' '.join([
- _('Your seed is important!'),
+ _('Your seed is your wallet!'),
+ _('If you lose your seed, your money will be permanently lost.'),
_('To make sure that you have properly saved your seed, please retype it here.')
])
return self.seed_input(title, message, is_valid)
diff --git a/lib/base_wizard.py b/lib/base_wizard.py
@@ -224,6 +224,8 @@ class BaseWizard(object):
self.on_keystore(k)
def restore_from_seed(self):
+ self.opt_bip39 = True
+ self.opt_ext = True
self.restore_seed_dialog(run_next=self.on_seed, is_valid=keystore.is_seed)
def on_seed(self, seed, add_passphrase, is_bip39):
@@ -302,6 +304,8 @@ class BaseWizard(object):
def create_seed(self):
from electrum.mnemonic import Mnemonic
seed = Mnemonic('en').make_seed()
+ self.opt_bip39 = False
+ self.opt_ext = True
self.show_seed_dialog(run_next=self.confirm_seed, seed_text=seed)
def confirm_seed(self, seed):
diff --git a/plugins/trustedcoin/trustedcoin.py b/plugins/trustedcoin/trustedcoin.py
@@ -346,6 +346,8 @@ class TrustedCoinPlugin(BasePlugin):
('create_seed', _('Create a new seed')),
('restore_wallet', _('I already have a seed')),
]
+ wizard.opt_bip39 = False
+ wizard.opt_ext = False
wizard.choice_dialog(title=title, message=message, choices=choices, run_next=wizard.run)
def create_seed(self, wizard):