Browse Source

Select site field and open suggestions after web extension opened

When the user open the pop up of the web extension, site field is automatically populated with the base domain name.
On site https://www.example.org/ site field become www.example.org.
Some users use example.org, some other example only, some users a custom site.

It's easy now to:
 - remove the site by hitting backspace
 - or hitting arrow down to get the first entry: example
 - or hitting arrow down x 2 to get example.org
 - or hitting tab to keep www.example.org and go on login

Fixes: https://github.com/lesspass/lesspass/issues/386
Fixes: https://github.com/lesspass/lesspass/issues/439
pull/448/head
Guillaume Vincent 5 years ago
parent
commit
99f089ed66
6 changed files with 30 additions and 23 deletions
  1. +1
    -1
      packages/lesspass-pure/cypress/integration/connectedMode.spec.js
  2. +3
    -3
      packages/lesspass-pure/cypress/integration/passwordGeneration.spec.js
  3. +4
    -4
      packages/lesspass-pure/dist/lesspass.min.js
  4. +5
    -1
      packages/lesspass-pure/src/components/InputSite.vue
  5. +13
    -10
      packages/lesspass-pure/src/views/PasswordGenerator.vue
  6. +4
    -4
      packages/lesspass-web-extension/extension/dist/lesspass.min.js

+ 1
- 1
packages/lesspass-pure/cypress/integration/connectedMode.spec.js View File

@@ -9,7 +9,7 @@ describe("Connected Mode", function() {
cy.get("#fingerprint .fa-btc").should("be.visible"); cy.get("#fingerprint .fa-btc").should("be.visible");
cy.get("#fingerprint .fa-subway").should("be.visible"); cy.get("#fingerprint .fa-subway").should("be.visible");
cy.get("#signInButton").click(); cy.get("#signInButton").click();
cy.get("#siteField").type("lesspass.com");
cy.get("#siteField").type("lesspass.com").blur();
cy.get("#login").type("test@lesspass.com"); cy.get("#login").type("test@lesspass.com");
cy.get("#passwordField").type("test@lesspass.com"); cy.get("#passwordField").type("test@lesspass.com");
cy.get("#generatePassword__btn").click(); cy.get("#generatePassword__btn").click();


+ 3
- 3
packages/lesspass-pure/cypress/integration/passwordGeneration.spec.js View File

@@ -19,7 +19,7 @@ describe("Password Generation", function() {
} }


cy.visit("/"); cy.visit("/");
cy.get("#siteField").type("lesspass.com");
cy.get("#siteField").type("lesspass.com").blur();
cy.get("#login").type("test@lesspass.com"); cy.get("#login").type("test@lesspass.com");
cy.get("#passwordField").type("test@lesspass.com"); cy.get("#passwordField").type("test@lesspass.com");
cy.wait(500); cy.wait(500);
@@ -105,7 +105,7 @@ describe("Password Generation", function() {
}); });
it("should generate password when hit enter nrt_266", function() { it("should generate password when hit enter nrt_266", function() {
cy.visit("/"); cy.visit("/");
cy.get("#siteField").type("lesspass.com");
cy.get("#siteField").type("lesspass.com").blur();
cy.get("#login").type("test@lesspass.com"); cy.get("#login").type("test@lesspass.com");
cy.get("#passwordField") cy.get("#passwordField")
.type("test@lesspass.com") .type("test@lesspass.com")
@@ -129,7 +129,7 @@ describe("Password Generation", function() {
}); });
it("should clear password generated when master password change", function() { it("should clear password generated when master password change", function() {
cy.visit("/"); cy.visit("/");
cy.get("#siteField").type("example.org");
cy.get("#siteField").type("example.org").blur();
cy.get("#login").type("user"); cy.get("#login").type("user");
cy.get("#passwordField").type("password"); cy.get("#passwordField").type("password");
cy.get("#generatePassword__btn").should("be.visible"); cy.get("#generatePassword__btn").should("be.visible");


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


+ 5
- 1
packages/lesspass-pure/src/components/InputSite.vue View File

@@ -38,7 +38,9 @@
} }
}, },
mounted() { mounted() {
this.awesomplete = new Awesomplete(this.$refs.siteField);
this.awesomplete = new Awesomplete(this.$refs.siteField,{
minChars: 0,
});
this.awesomplete.item = (element, input) => { this.awesomplete.item = (element, input) => {
let item = Awesomplete.ITEM(element.value.site, input); let item = Awesomplete.ITEM(element.value.site, input);
item.innerHTML += ` ${element.value.login}`; item.innerHTML += ` ${element.value.login}`;
@@ -80,6 +82,8 @@
return {site: suggestion, suggestion: true, login: ''} return {site: suggestion, suggestion: true, login: ''}
}); });
this.awesomplete.list = this.passwords.concat(suggestions); this.awesomplete.list = this.passwords.concat(suggestions);
this.awesomplete.evaluate();
this.awesomplete.open();
} }
}, },
methods: {} methods: {}


+ 13
- 10
packages/lesspass-pure/src/views/PasswordGenerator.vue View File

@@ -227,16 +227,19 @@ export default {
}); });
}, },
focusBestInputField() { focusBestInputField() {
try {
const site = this.$refs.site.$refs.siteField;
const login = this.$refs.login;
const masterPassword = this.$refs.masterPassword;
if (site && !site.value) return void site.focus();
if (login && !login.value) return void login.focus();
masterPassword.$refs.passwordField.focus();
}
catch(err) {
console.error("Can't focus password field")
const site = this.$refs.site;
const login = this.$refs.login;
const masterPassword = this.$refs.masterPassword;
if (site && login && masterPassword){
const siteField = site.$refs.siteField;
if (siteField.value && login.value){
return void masterPassword.$refs.passwordField.focus();
}
if (siteField.value && !login.value){
return void siteField.select();
}else{
return void siteField.focus();
}
} }
}, },
copyPassword() { copyPassword() {


+ 4
- 4
packages/lesspass-web-extension/extension/dist/lesspass.min.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save