mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 02:35:20 +00:00
during wallet restore allow user to retry after invalid OTP. add abort button on kivy.
This commit is contained in:
parent
248a3a5755
commit
531a2a5c1f
3 changed files with 37 additions and 9 deletions
|
@ -503,7 +503,7 @@ class ElectrumWindow(App):
|
|||
else:
|
||||
self.load_wallet(wallet)
|
||||
else:
|
||||
Logger.debug('Electrum: Wallet not found. Launching install wizard')
|
||||
Logger.debug('Electrum: Wallet not found or action needed. Launching install wizard')
|
||||
storage = WalletStorage(path, manual_upgrades=True)
|
||||
wizard = Factory.InstallWizard(self.electrum_config, self.plugins, storage)
|
||||
wizard.bind(on_wizard_complete=self.on_wizard_complete)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
from functools import partial
|
||||
import threading
|
||||
import os
|
||||
|
||||
from kivy.app import App
|
||||
from kivy.clock import Clock
|
||||
|
@ -238,11 +239,23 @@ Builder.load_string('''
|
|||
text: root.message2
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
size_hint: 1, 0.2
|
||||
size_hint: 1, 0.3
|
||||
Widget
|
||||
CheckBox:
|
||||
id:cb
|
||||
on_state: Clock.schedule_once(root.on_cb)
|
||||
Widget
|
||||
size_hint: 1, 1
|
||||
height: '48sp'
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
WizardButton:
|
||||
id: abort
|
||||
text: _('Abort creation')
|
||||
on_release: root.abort_wallet_creation()
|
||||
size_hint: 1, None
|
||||
Widget
|
||||
size_hint: 1, None
|
||||
|
||||
<WizardNewOTPDialog>
|
||||
message : ''
|
||||
|
@ -618,6 +631,12 @@ class WizardKnownOTPDialog(WizardOTPDialogBase):
|
|||
self.ids.otp.text = ''
|
||||
self.ids.next.disabled = not self.ids.cb.active
|
||||
|
||||
def abort_wallet_creation(self):
|
||||
self._on_release = True
|
||||
os.unlink(self.wizard.storage.path)
|
||||
self.wizard.terminate()
|
||||
self.dismiss()
|
||||
|
||||
|
||||
class WizardNewOTPDialog(WizardOTPDialogBase):
|
||||
|
||||
|
|
|
@ -581,15 +581,24 @@ class TrustedCoinPlugin(BasePlugin):
|
|||
def do_auth(self, wizard, short_id, otp, xpub3):
|
||||
try:
|
||||
server.auth(short_id, otp)
|
||||
except TrustedCoinException as e:
|
||||
if e.status_code == 400: # invalid OTP
|
||||
wizard.show_message(_('Invalid one-time password.'))
|
||||
# ask again for otp
|
||||
self.request_otp_dialog(wizard, short_id, None, xpub3)
|
||||
else:
|
||||
wizard.show_message(str(e))
|
||||
wizard.terminate()
|
||||
except Exception as e:
|
||||
wizard.show_message(str(e))
|
||||
return
|
||||
k3 = keystore.from_xpub(xpub3)
|
||||
wizard.storage.put('x3/', k3.dump())
|
||||
wizard.storage.put('use_trustedcoin', True)
|
||||
wizard.storage.write()
|
||||
wizard.wallet = Wallet_2fa(wizard.storage)
|
||||
wizard.run('create_addresses')
|
||||
wizard.terminate()
|
||||
else:
|
||||
k3 = keystore.from_xpub(xpub3)
|
||||
wizard.storage.put('x3/', k3.dump())
|
||||
wizard.storage.put('use_trustedcoin', True)
|
||||
wizard.storage.write()
|
||||
wizard.wallet = Wallet_2fa(wizard.storage)
|
||||
wizard.run('create_addresses')
|
||||
|
||||
def on_reset_auth(self, wizard, short_id, seed, passphrase, xpub3):
|
||||
xprv1, xpub1, xprv2, xpub2 = self.xkeys_from_seed(seed, passphrase)
|
||||
|
|
Loading…
Add table
Reference in a new issue