Browse Source

Don't load password profile

fix https://github.com/lesspass/lesspass/issues/285
pull/342/head
Guillaume Vincent 7 years ago
parent
commit
1912319327
7 changed files with 53 additions and 62 deletions
  1. +1
    -1
      dist/lesspass.min.css
  2. +9
    -9
      dist/lesspass.min.js
  3. +18
    -18
      package-lock.json
  4. +6
    -6
      package.json
  5. +0
    -6
      src/LessPass.scss
  6. +4
    -1
      src/store/mutations.js
  7. +15
    -21
      test/unit/store.mutations.js

+ 1
- 1
dist/lesspass.min.css
File diff suppressed because it is too large
View File


+ 9
- 9
dist/lesspass.min.js
File diff suppressed because it is too large
View File


+ 18
- 18
package-lock.json View File

@@ -9567,9 +9567,9 @@
}
},
"vue": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.4.4.tgz",
"integrity": "sha512-PCiRmc8ZT1DD5+BN8QUAmnkBefcCLfZVSuhc1u7iu5JoPrSHyyk/+4nehm7k2xVMi8+RFLk5WIHAN14UKF0txw=="
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.5.2.tgz",
"integrity": "sha512-Au9rf8fPkBulFHfZ406UaQDd1jH9fqGRIM+0IHilrXnJ/0TeeMH4SBkNxWf2dGevl2S3aVeu0E/WklEv0/msag=="
},
"vue-hot-reload-api": {
"version": "2.1.1",
@@ -9646,9 +9646,9 @@
}
},
"vue-polyglot": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/vue-polyglot/-/vue-polyglot-0.2.2.tgz",
"integrity": "sha512-wcnDk4Daq9heTWFRXN3qTZ0L0RQuFtAqScBUCrvCQRiihE12FOJie1FZ4KEB626i/itG/iUNN2lgCFARlnVrsg==",
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/vue-polyglot/-/vue-polyglot-0.2.3.tgz",
"integrity": "sha512-m30yICLAi9MGyLpK0kyXLQZ4YTI+n56qPiAA2+LLmGSOotxOPb3nqFOyedv4WuSQBohXKrH7lj93y7G58rfQ/A==",
"requires": {
"axios": "0.15.3"
},
@@ -9678,9 +9678,9 @@
"dev": true
},
"vue-router": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-2.7.0.tgz",
"integrity": "sha512-kxgsT50dDExua3i103nxNBjlfk8LeUmO9iujVxXV42MnISINHUjqMrknpOOJEg+i9nEkoVgG8N86Pklze35c/A=="
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-2.8.1.tgz",
"integrity": "sha512-MC4jacHBhTPKtmcfzvaj2N7g6jgJ/Z/eIjZdt+yUaUOM1iKC0OUIlO/xCtz6OZFFTNUJs/1YNro2GN/lE+nOXA=="
},
"vue-style-loader": {
"version": "3.0.3",
@@ -9693,9 +9693,9 @@
}
},
"vue-template-compiler": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.4.4.tgz",
"integrity": "sha512-XdHsNi8Z5WqwuFl/Z5eLKgE2DOEEOdMk1aA459uSgvwyy+pjKLBlQWsUpAtoR6o6Wmpujw6NtinAUGuqSTituQ==",
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.5.2.tgz",
"integrity": "sha512-FtbqBWvEANPZaeRo09VKEF7tET4kPMtJYqwsy/Nm1fdr1zIcwcTI7CXqeraXMviczho5IjtxZ6Fab1Enm4rHmA==",
"dev": true,
"requires": {
"de-indent": "1.0.2",
@@ -9714,9 +9714,9 @@
"integrity": "sha512-kCpLd/DjZ8OpYvNH6/OZiFVBlqqXDrKnYUdfWcGme3rxwK5JwM9kIY9P0mxSQQQ4w1mguhokRpO75pKLXX4Miw=="
},
"vuex": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-2.3.1.tgz",
"integrity": "sha1-zejpl8H5lXcZvH3qFU+appHZgaY="
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-2.5.0.tgz",
"integrity": "sha512-5oJPOJySBgSgSzoeO+gZB/BbN/XsapgIF6tz34UwJqnGZMQurzIO3B4KIBf862gfc9ya+oduY5sSkq+5/oOilQ=="
},
"vuex-persistedstate": {
"version": "2.0.0",
@@ -9728,9 +9728,9 @@
}
},
"vuex-router-sync": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/vuex-router-sync/-/vuex-router-sync-4.2.0.tgz",
"integrity": "sha512-Eqm4QzflZd/uxxvykyStJV7WIbHtsLbglSxKNx1U4hh3/0WlNQeUNtSaTfZ660uJ846tuVIC9l5wROEQwhxHYg=="
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/vuex-router-sync/-/vuex-router-sync-4.3.2.tgz",
"integrity": "sha512-Uwi1aPM1U9IOzEqJl8r3aCQm8l2H+IMm0lMQtznY7ENv8XK0w+6e+le6r06k0W9ud7qBJ4fDjbCcNpXBdnO3Xg=="
},
"walk": {
"version": "2.3.9",


+ 6
- 6
package.json View File

@@ -33,13 +33,13 @@
"jwt-decode": "^2.2.0",
"lesspass": "^6.0.0",
"lodash.debounce": "^4.0.8",
"vue": "^2.4.4",
"vue-polyglot": "^0.2.2",
"vue-router": "^2.7.0",
"vue": "^2.5.2",
"vue-polyglot": "^0.2.3",
"vue-router": "^2.8.1",
"vuejs-paginate": "^1.2.0",
"vuex": "^2.3.1",
"vuex": "^2.5.0",
"vuex-persistedstate": "^2.0.0",
"vuex-router-sync": "^4.2.0"
"vuex-router-sync": "^4.3.2"
},
"devDependencies": {
"ava": "^0.22.0",
@@ -67,7 +67,7 @@
"url-loader": "^0.5.9",
"vue-loader": "^13.0.4",
"vue-polyglot-utils": "^0.1.1",
"vue-template-compiler": "^2.4.4",
"vue-template-compiler": "^2.5.2",
"walk": "^2.3.9",
"webpack": "^3.5.5",
"webpack-dev-server": "^2.7.1"


+ 0
- 6
src/LessPass.scss View File

@@ -47,16 +47,10 @@
#lesspass {
color: #464646;
max-width: 420px;
border: none;

.card-header {
border-bottom: none;
}
}

.lesspass__inner-box {
min-height: 240px;
border: $card-border-width solid $card-border-color;
}

@media (max-width: 419px) {


+ 4
- 1
src/store/mutations.js View File

@@ -39,6 +39,9 @@ export default {
state.password.site = site;
},
[types.LOAD_PASSWORD_PROFILE](state, { site }) {
if (!site || typeof state.password.id !== "undefined") {
return;
}
let siteMatch = false;
const passwords = state.passwords || [];
const siteWithoutWWW = site.replace(/^www./g, "");
@@ -54,7 +57,7 @@ export default {
}
}
if (site && !siteMatch) {
state.password = { ...state.defaultPassword };
state.password = Object.assign({}, state.password, { site });
}
},
[types.SET_MESSAGE](state, { message }) {


+ 15
- 21
test/unit/store.mutations.js View File

@@ -133,15 +133,15 @@ test("SET_BASE_URL", t => {
test("LOAD_PASSWORD_PROFILE", t => {
const state = {
password: {
login: "contact@example.org",
site: "lesspass.com",
login: "",
site: "",
uppercase: true,
lowercase: true,
numbers: true,
symbols: true,
length: 12,
length: 16,
counter: 1,
version: 1
version: 2
},
passwords: [
{
@@ -159,7 +159,7 @@ test("LOAD_PASSWORD_PROFILE", t => {
{
id: "7cbadebf-49c8-4136-a579-6ee5beb6de7c",
login: "contact@example.org",
site: "example.org",
site: "www.example.org",
lowercase: true,
uppercase: false,
symbols: false,
@@ -199,19 +199,17 @@ test("LOAD_PASSWORD_PROFILE", t => {
t.deepEqual(state.password, state.passwords[1]);
});

test("LOAD_PASSWORD_PROFILE on different site", t => {
test("LOAD_PASSWORD_PROFILE do nothing if id not empty", t => {
const state = {
password: {
site: "example.org",
login: "test@example.org"
id: "1",
site: "example.org"
},
defaultPassword: {
login: ""
}
passwords: []
};
const LOAD_PASSWORD_PROFILE = mutations[types.LOAD_PASSWORD_PROFILE];
LOAD_PASSWORD_PROFILE(state, { site: "lesspass.com" });
t.is(state.password.login, "");
t.is(state.password.site, "example.org");
});

test("LOAD_PASSWORD_PROFILE with passwords", t => {
@@ -233,18 +231,17 @@ test("LOAD_PASSWORD_PROFILE with passwords", t => {
test("LOAD_PASSWORD_PROFILE with no site keep password profile", t => {
const state = {
password: {
id: "1",
site: "example.org",
login: "contact@example.org",
length: 8,
version: 2
},
defaultPassword: {
login: "",
length: 16
}
passwords: []
};
const LOAD_PASSWORD_PROFILE = mutations[types.LOAD_PASSWORD_PROFILE];
LOAD_PASSWORD_PROFILE(state, { site: "" });
t.is(state.password.id, "1");
t.is(state.password.site, "example.org");
t.is(state.password.login, "contact@example.org");
t.is(state.password.length, 8);
@@ -256,14 +253,11 @@ test("LOAD_PASSWORD_PROFILE no passwords", t => {
password: {
site: ""
},
passwords: [],
defaultPassword: {
site: ""
}
passwords: []
};
const LOAD_PASSWORD_PROFILE = mutations[types.LOAD_PASSWORD_PROFILE];
LOAD_PASSWORD_PROFILE(state, { site: "account.google.com" });
t.is(state.password.site, "");
t.is(state.password.site, "account.google.com");
});

test("LOAD_PASSWORD_PROFILE multiple accounts matching criteria", t => {


Loading…
Cancel
Save