From cdf48982cb0854cc81a188718179ec96cb6223c3 Mon Sep 17 00:00:00 2001 From: Guillaume Vincent Date: Tue, 7 Feb 2017 22:41:25 +0100 Subject: [PATCH] load last profile for one minute --- src/store/mutations.js | 2 +- test/store.mutations.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/store/mutations.js b/src/store/mutations.js index 537a79f..fc2fa48 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -49,7 +49,7 @@ export default { } }, [types.LOAD_PASSWORD_FIRST_TIME](state){ - const tenMinutesAgo = new Date().getTime() - 10 * 60 * 1000; + const tenMinutesAgo = new Date().getTime() - 60 * 1000; if (tenMinutesAgo > state.lastUse) { setState(state, 'password', state.defaultPassword); } diff --git a/test/store.mutations.js b/test/store.mutations.js index 19763e7..e9f4d9c 100644 --- a/test/store.mutations.js +++ b/test/store.mutations.js @@ -159,13 +159,13 @@ test('SET_VERSION password null', t => { t.is(state.password.version, 2); }); -test('LOAD_PASSWORD_FIRST_TIME 5 minutes after last use', t => { +test('LOAD_PASSWORD_FIRST_TIME 30 seconds after last use', t => { const now = 1485989236000; const time = new Date(now); timekeeper.freeze(time); - const fiveMinutesBefore = now - 5 * 60 * 1000; + const thirtySecondBefore = now - 30 * 1000; const state = { - lastUse: fiveMinutesBefore, + lastUse: thirtySecondBefore, password: { login: 'test@example.org', length: 30 @@ -182,13 +182,13 @@ test('LOAD_PASSWORD_FIRST_TIME 5 minutes after last use', t => { timekeeper.reset(); }); -test('LOAD_PASSWORD_FIRST_TIME more than 10 minutes after last use', t => { +test('LOAD_PASSWORD_FIRST_TIME more than 1 minute after last use', t => { const now = 1485989236000; const time = new Date(now); timekeeper.freeze(time); - const twentyMinutesBefore = now - 20 * 60 * 1000; + const oneMinuteAndOneSecond = now - 61 * 1000; const state = { - lastUse: twentyMinutesBefore, + lastUse: oneMinuteAndOneSecond, password: { login: 'test@example.org', length: 30