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

Commit a91eea4

Browse files
valentinewallacetanx
authored andcommitted
Desktop: ensure that during seed recovery, the user confirms their new password.
Previously, the user would only enter their new password once. Now, they enter it twice to confirm its correctness.
1 parent ccae1af commit a91eea4

File tree

8 files changed

+3
-111
lines changed

8 files changed

+3
-111
lines changed

src/action/nav-mobile.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ class NavAction {
5555
this._navigate('RestoreSeed');
5656
}
5757

58-
goRestorePin() {
59-
this._navigate('RestorePin');
60-
}
61-
6258
goSeedSuccess() {
6359
this._navigate('SeedSuccess');
6460
}

src/action/nav.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ class NavAction {
2929
this._store.route = 'RestoreSeed';
3030
}
3131

32-
goRestorePassword() {
33-
this._store.route = 'RestorePassword';
34-
}
35-
3632
goSeedSuccess() {
3733
this._store.route = 'SeedSuccess';
3834
}

src/action/wallet.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class WalletAction {
325325
if (this._store.wallet.restoreIndex < 21) {
326326
this._store.wallet.restoreIndex += 3;
327327
} else {
328-
this._nav.goRestorePassword();
328+
this.initSetPassword();
329329
}
330330
}
331331

@@ -375,20 +375,6 @@ class WalletAction {
375375
await this.unlockWallet({ walletPassword: password });
376376
}
377377

378-
/**
379-
* Initialize the wallet with the password input the seed that was already
380-
* inputted, and the default recovery window.
381-
* @return {Promise<undefined>}
382-
*/
383-
async restoreWallet() {
384-
const { password, restoreSeed } = this._store.wallet;
385-
await this.initWallet({
386-
walletPassword: password,
387-
seedMnemonic: restoreSeed.toJSON(),
388-
recoveryWindow: RECOVERY_WINDOW,
389-
});
390-
}
391-
392378
/**
393379
* Unlock the wallet by calling the grpc api with the user chosen password.
394380
* @param {string} options.walletPassword The password used to encrypt the wallet

src/view/main.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import SeedSuccess from './seed-success';
1111
import SetPassword from './set-password';
1212
import SetPasswordConfirm from './set-password-confirm';
1313
import RestoreSeed from './restore-seed';
14-
import RestorePassword from './restore-password';
1514
import Password from './password';
1615
import ResetPasswordCurrent from './reset-password-current';
1716
import ResetPasswordNew from './reset-password-new';
@@ -83,9 +82,6 @@ class MainView extends Component {
8382
{route === 'RestoreSeed' && (
8483
<RestoreSeed store={store} wallet={wallet} />
8584
)}
86-
{route === 'RestorePassword' && (
87-
<RestorePassword store={store} wallet={wallet} nav={nav} />
88-
)}
8985
{route === 'Password' && <Password store={store} wallet={wallet} />}
9086
{route === 'ResetPasswordCurrent' && (
9187
<ResetPasswordCurrent store={store} nav={nav} wallet={wallet} />

src/view/restore-password.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

stories/screen-story.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ import SetPasswordConfirm from '../src/view/set-password-confirm';
7373
import SetPinConfirmMobile from '../src/view/set-pin-confirm-mobile';
7474
import Password from '../src/view/password';
7575
import PinMobile from '../src/view/pin-mobile';
76-
import RestorePassword from '../src/view/restore-password';
7776
import ResetPasswordCurrent from '../src/view/reset-password-current';
7877
import ResetPasswordNew from '../src/view/reset-password-new';
7978
import ResetPasswordConfirm from '../src/view/reset-password-confirm';
@@ -155,9 +154,6 @@ storiesOf('Screens', module)
155154
))
156155
.add('Password', () => <Password store={store} wallet={wallet} />)
157156
.add('PIN (Mobile)', () => <PinMobile store={store} auth={auth} />)
158-
.add('Restore Wallet: Password', () => (
159-
<RestorePassword store={store} wallet={wallet} nav={nav} />
160-
))
161157
.add('Reset Password - Current', () => (
162158
<ResetPasswordCurrent store={store} wallet={wallet} nav={nav} />
163159
))

test/unit/action/nav.spec.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ describe('Action Nav Unit Tests', () => {
8181
});
8282
});
8383

84-
describe('goRestorePassword()', () => {
85-
it('should set correct route', () => {
86-
nav.goRestorePassword();
87-
expect(store.route, 'to equal', 'RestorePassword');
88-
});
89-
});
90-
9184
describe('goNewAddress()', () => {
9285
it('should set correct route', () => {
9386
nav.goNewAddress();

test/unit/action/wallet.spec.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,14 @@ describe('Action Wallet Unit Tests', () => {
387387
it('should navigate to password screen if restoreIndex > 20', () => {
388388
store.wallet.restoreIndex = 21;
389389
wallet.initNextRestorePage();
390-
expect(nav.goRestorePassword, 'was called once');
390+
expect(nav.goSetPassword, 'was called once');
391391
expect(store.wallet.restoreIndex, 'to equal', 21);
392392
});
393393

394394
it('should increment restoreIndex if less than 21', async () => {
395395
store.wallet.restoreIndex = 18;
396396
wallet.initNextRestorePage();
397-
expect(nav.goRestorePassword, 'was not called');
397+
expect(nav.goSetPassword, 'was not called');
398398
expect(store.wallet.restoreIndex, 'to equal', 21);
399399
});
400400
});
@@ -469,24 +469,6 @@ describe('Action Wallet Unit Tests', () => {
469469
});
470470
});
471471

472-
describe('restoreWallet()', () => {
473-
beforeEach(() => {
474-
sandbox.stub(wallet, 'initWallet');
475-
});
476-
477-
it('calls initWallet with password and restoreSeed', async () => {
478-
wallet.setPassword({ password: 'secret123' });
479-
const seed = Array(24).fill('foo');
480-
store.wallet.restoreSeed = seed;
481-
await wallet.restoreWallet();
482-
expect(wallet.initWallet, 'was called with', {
483-
walletPassword: 'secret123',
484-
seedMnemonic: seed,
485-
recoveryWindow: RECOVERY_WINDOW,
486-
});
487-
});
488-
});
489-
490472
describe('unlockWallet()', () => {
491473
it('should unlock wallet', async () => {
492474
grpc.sendUnlockerCommand.withArgs('UnlockWallet').resolves();

0 commit comments

Comments
 (0)