diff --git a/src/action/wallet.js b/src/action/wallet.js index 8a937a82c..ff966a845 100644 --- a/src/action/wallet.js +++ b/src/action/wallet.js @@ -298,6 +298,7 @@ class WalletAction { this._nav.goWait(); observe(this._store, 'lndReady', () => this._nav.goHome()); } catch (err) { + this.setPassword({ password: '' }); this._notification.display({ type: 'error', msg: 'Invalid password' }); } } diff --git a/test/unit/action/wallet.spec.js b/test/unit/action/wallet.spec.js index a8584413b..ab51e346f 100644 --- a/test/unit/action/wallet.spec.js +++ b/test/unit/action/wallet.spec.js @@ -354,13 +354,16 @@ describe('Action Wallet Unit Tests', () => { expect(nav.goHome, 'was called once'); }); - it('should display error notification on failure', async () => { + it('should display error notification on failure and clear password', async () => { + wallet.setPassword('not-empty'); + expect(store.wallet.password, 'not to be', ''); grpc.sendUnlockerCommand .withArgs('UnlockWallet') .rejects(new Error('Boom!')); await wallet.unlockWallet({ walletPassword: 'baz' }); expect(notification.display, 'was called once'); expect(nav.goWait, 'was not called'); + expect(store.wallet.password, 'to be', ''); }); });