Selaa lähdekoodia

SET_VERSION should change password length

close https://github.com/lesspass/lesspass/issues/148
pull/342/head
Guillaume Vincent 7 vuotta sitten
vanhempi
commit
53011646de
2 muutettua tiedostoa jossa 15 lisäystä ja 8 poistoa
  1. +3
    -5
      src/store/mutations.js
  2. +12
    -3
      test/store.mutations.js

+ 3
- 5
src/store/mutations.js Näytä tiedosto

@@ -42,11 +42,9 @@ export default {
state.baseURL = baseURL;
},
[types.SET_VERSION](state, {version}){
if (state.password === null) {
state.password = {version};
} else {
state.password.version = version;
}
const length = version === 1 ? 12 : 16;
state.password.version = version;
state.password.length = length;
},
[types.LOAD_PASSWORD_FIRST_TIME](state){
const tenMinutesAgo = new Date().getTime() - 60 * 1000;


+ 12
- 3
test/store.mutations.js Näytä tiedosto

@@ -150,13 +150,22 @@ test('SET_VERSION', t => {
t.is(state.password.version, 1);
});

test('SET_VERSION password null', t => {
test('SET_VERSION 1 should modify length to 12', t => {
const SET_VERSION = mutations[types.SET_VERSION];
const state = {
password: null,
password: {length: 16, version: 2},
};
SET_VERSION(state, {version: 1});
t.is(state.password.length, 12);
});

test('SET_VERSION 2 should modify length to 16', t => {
const SET_VERSION = mutations[types.SET_VERSION];
const state = {
password: {length: 12, version: 1},
};
SET_VERSION(state, {version: 2});
t.is(state.password.version, 2);
t.is(state.password.length, 16);
});

test('LOAD_PASSWORD_FIRST_TIME 30 seconds after last use', t => {


Ladataan…
Peruuta
Tallenna