mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Remove unnecessary unlock step (#12840)
As part of the unlock process, currently the seed phrase is retrieved from the background then discarded. This step is pointless, so it has been deleted.
This commit is contained in:
parent
2856ea7606
commit
8835642c6d
@ -69,19 +69,6 @@ export function tryUnlockMetamask(password) {
|
||||
dispatch(unlockSucceeded());
|
||||
return forceUpdateMetamaskState(dispatch);
|
||||
})
|
||||
.then(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
background.verifySeedPhrase((err) => {
|
||||
if (err) {
|
||||
dispatch(displayWarning(err.message));
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
dispatch(hideLoadingIndication());
|
||||
})
|
||||
|
@ -45,17 +45,13 @@ describe('Actions', () => {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
it('calls submitPassword and verifySeedPhrase', async () => {
|
||||
it('calls submitPassword', async () => {
|
||||
const store = mockStore();
|
||||
|
||||
const submitPassword = background.submitPassword.callsFake((_, cb) =>
|
||||
cb(),
|
||||
);
|
||||
|
||||
const verifySeedPhrase = background.verifySeedPhrase.callsFake((cb) =>
|
||||
cb(),
|
||||
);
|
||||
|
||||
actions._setBackgroundConnection(background);
|
||||
|
||||
const expectedActions = [
|
||||
@ -72,7 +68,6 @@ describe('Actions', () => {
|
||||
await store.dispatch(actions.tryUnlockMetamask());
|
||||
|
||||
expect(submitPassword.callCount).toStrictEqual(1);
|
||||
expect(verifySeedPhrase.callCount).toStrictEqual(1);
|
||||
|
||||
expect(store.getActions()).toStrictEqual(expectedActions);
|
||||
});
|
||||
@ -97,36 +92,6 @@ describe('Actions', () => {
|
||||
|
||||
expect(store.getActions()).toStrictEqual(expectedActions);
|
||||
});
|
||||
|
||||
it('displays warning error and unlock failed when verifySeed fails', async () => {
|
||||
const store = mockStore();
|
||||
|
||||
background.submitPassword.callsFake((_, cb) => cb());
|
||||
background.verifySeedPhrase.callsFake((cb) => {
|
||||
cb(new Error('error'));
|
||||
});
|
||||
|
||||
actions._setBackgroundConnection(background);
|
||||
|
||||
const expectedActions = [
|
||||
{ type: 'SHOW_LOADING_INDICATION', value: undefined },
|
||||
{ type: 'UNLOCK_IN_PROGRESS' },
|
||||
{ type: 'UNLOCK_SUCCEEDED', value: undefined },
|
||||
{
|
||||
type: 'UPDATE_METAMASK_STATE',
|
||||
value: baseMockState,
|
||||
},
|
||||
{ type: 'DISPLAY_WARNING', value: 'error' },
|
||||
{ type: 'UNLOCK_FAILED', value: 'error' },
|
||||
{ type: 'HIDE_LOADING_INDICATION' },
|
||||
];
|
||||
|
||||
await expect(
|
||||
store.dispatch(actions.tryUnlockMetamask('test')),
|
||||
).rejects.toThrow('error');
|
||||
|
||||
expect(store.getActions()).toStrictEqual(expectedActions);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#createNewVaultAndRestore', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user