1
0

kivy: save password after wallet creation

Previously, operations that require password
would fail until the wallet is reopened
This commit is contained in:
ThomasV
2020-12-03 10:23:01 +01:00
parent 7ce4727507
commit 3f9d7d8b33
2 changed files with 11 additions and 6 deletions

View File

@@ -631,8 +631,9 @@ class ElectrumWindow(App, Logger):
else:
return ''
def on_wizard_complete(self, storage, db):
def on_wizard_complete(self, storage, db, password):
if storage:
self.password = password
wallet = Wallet(db, storage, config=self.electrum_config)
wallet.start_network(self.daemon.network)
self.daemon.add_wallet(wallet)
@@ -665,17 +666,16 @@ class ElectrumWindow(App, Logger):
d = Question(_('Do you want to launch the wizard again?'), handle_answer)
d.open()
def on_open_wallet(self, pw, storage):
def on_open_wallet(self, password, storage):
if not storage.file_exists():
wizard = Factory.InstallWizard(self.electrum_config, self.plugins)
wizard.path = storage.path
wizard.run('new')
else:
assert storage.is_past_initial_decryption()
self.password = pw
db = WalletDB(storage.read(), manual_upgrades=False)
assert not db.requires_upgrade()
self.on_wizard_complete(storage, db)
self.on_wizard_complete(storage, db, password)
def on_stop(self):
self.logger.info('on_stop')

View File

@@ -1060,9 +1060,14 @@ class InstallWizard(BaseWizard, Widget):
self.app = App.get_running_app()
def terminate(self, *, storage=None, db=None, aborted=False):
if storage is None and not aborted:
# storage must be None because manual upgrades are disabled on Kivy
assert storage is None
if not aborted:
password = self.pw_args.password
storage, db = self.create_storage(self.path)
self.app.on_wizard_complete(storage, db)
else:
password = None
self.app.on_wizard_complete(storage, db, password)
def choice_dialog(self, **kwargs):
choices = kwargs['choices']