mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
distinguish invalid otp from server failure when sending tx
This commit is contained in:
parent
27012e7394
commit
4fea9edd11
1 changed files with 10 additions and 5 deletions
|
@ -32,7 +32,7 @@ from kivy.clock import Clock
|
||||||
|
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
from electrum.plugins import hook
|
from electrum.plugins import hook
|
||||||
from .trustedcoin import TrustedCoinPlugin, server, KIVY_DISCLAIMER
|
from .trustedcoin import TrustedCoinPlugin, server, KIVY_DISCLAIMER, TrustedCoinException
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,10 +62,15 @@ class Plugin(TrustedCoinPlugin):
|
||||||
def on_otp(self, wallet, tx, otp, on_success, on_failure):
|
def on_otp(self, wallet, tx, otp, on_success, on_failure):
|
||||||
try:
|
try:
|
||||||
wallet.on_otp(tx, otp)
|
wallet.on_otp(tx, otp)
|
||||||
except:
|
except TrustedCoinException as e:
|
||||||
Clock.schedule_once(lambda dt: on_failure(_("Invalid OTP")))
|
if e.status_code == 400: # invalid OTP
|
||||||
return
|
Clock.schedule_once(lambda dt: on_failure(_('Invalid one-time password.')))
|
||||||
on_success(tx)
|
else:
|
||||||
|
Clock.schedule_once(lambda dt, bound_e=e: on_failure(_('Error') + ':' + str(bound_e)))
|
||||||
|
except Exception as e:
|
||||||
|
Clock.schedule_once(lambda dt, bound_e=e: on_failure(_('Error') + ':' + str(bound_e)))
|
||||||
|
else:
|
||||||
|
on_success(tx)
|
||||||
|
|
||||||
def accept_terms_of_use(self, wizard):
|
def accept_terms_of_use(self, wizard):
|
||||||
tos = server.get_terms_of_service()
|
tos = server.get_terms_of_service()
|
||||||
|
|
Loading…
Add table
Reference in a new issue