Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 453adbd

Browse files
authored
Merge pull request #698 from erkarl/clear-invalid-password
Clear password field if incorrectly entered
2 parents 328dbff + 017b079 commit 453adbd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/action/wallet.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ class WalletAction {
298298
this._nav.goWait();
299299
observe(this._store, 'lndReady', () => this._nav.goHome());
300300
} catch (err) {
301+
this.setPassword({ password: '' });
301302
this._notification.display({ type: 'error', msg: 'Invalid password' });
302303
}
303304
}

test/unit/action/wallet.spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,16 @@ describe('Action Wallet Unit Tests', () => {
354354
expect(nav.goHome, 'was called once');
355355
});
356356

357-
it('should display error notification on failure', async () => {
357+
it('should display error notification on failure and clear password', async () => {
358+
wallet.setPassword('not-empty');
359+
expect(store.wallet.password, 'not to be', '');
358360
grpc.sendUnlockerCommand
359361
.withArgs('UnlockWallet')
360362
.rejects(new Error('Boom!'));
361363
await wallet.unlockWallet({ walletPassword: 'baz' });
362364
expect(notification.display, 'was called once');
363365
expect(nav.goWait, 'was not called');
366+
expect(store.wallet.password, 'to be', '');
364367
});
365368
});
366369

0 commit comments

Comments
 (0)