electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit dac5af8eca4fc37b2b3b8a88bc66f1c660c6517b
parent 30845ee7769a66d736bbc3d451fc85c0d58e1ea1
Author: SomberNight <somber.night@protonmail.com>
Date:   Sat, 22 Dec 2018 09:06:30 +0100

trustedcoin: friendlier error msg for invalid otp when signing

Diffstat:
Melectrum/plugins/trustedcoin/trustedcoin.py | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/electrum/plugins/trustedcoin/trustedcoin.py b/electrum/plugins/trustedcoin/trustedcoin.py @@ -45,7 +45,7 @@ from electrum.mnemonic import Mnemonic from electrum.wallet import Multisig_Wallet, Deterministic_Wallet from electrum.i18n import _ from electrum.plugin import BasePlugin, hook -from electrum.util import NotEnoughFunds +from electrum.util import NotEnoughFunds, UserFacingException from electrum.storage import STO_EV_USER_PW from electrum.network import Network @@ -319,7 +319,13 @@ class Wallet_2fa(Multisig_Wallet): otp = int(otp) long_user_id, short_id = self.get_user_id() raw_tx = tx.serialize() - r = server.sign(short_id, raw_tx, otp) + try: + r = server.sign(short_id, raw_tx, otp) + except TrustedCoinException as e: + if e.status_code == 400: # invalid OTP + raise UserFacingException(_('Invalid one-time password.')) from e + else: + raise if r: raw_tx = r.get('transaction') tx.update(raw_tx)