Browse Source

Merge branch 'kir0ul-issue_597'

b5
Guillaume Vincent 3 years ago
parent
commit
a17bc28527
6 changed files with 81 additions and 45 deletions
  1. +1
    -1
      CONTRIBUTING.md
  2. +4
    -7
      packages/lesspass-pure/cypress/integration/connectedMode.spec.js
  3. +35
    -15
      packages/lesspass-pure/src/components/MasterPassword.vue
  4. +1
    -0
      packages/lesspass-pure/src/i18n/en.json
  5. +2
    -1
      packages/lesspass-pure/src/i18n/fr.json
  6. +38
    -21
      packages/lesspass-pure/src/views/Login.vue

+ 1
- 1
CONTRIBUTING.md View File

@@ -39,7 +39,7 @@ If you are working on the CLI, you will need:
Here are some folders that worth noticing:

* `package` contains the code for the web version and the browser extension. Development is done with `javascript` and `Vue`.
* `lesspass-pure` contains the core of `lesspass`. Running `yarn dev` in this folder will run a `lesspass` instance locally.
* `lesspass-pure` contains the core of `lesspass`. Running `yarn start` in this folder will run a `lesspass` instance locally.
* `lesspass-web-extension` contains the code specific for the web extension.
* `lesspass-render-password` contains the algorithm to generate passwords.
* `cli` contains the command line version. Development is done with `python`.


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

@@ -5,10 +5,9 @@ describe("Connected Mode", function() {
cy.get(".fa-sign-in").click();
cy.get("#email").type("test@lesspass.com");
cy.get("#passwordField").type("test@lesspass.com");
cy.get("#encryptMasterPassword__btn").click();
cy.get("#fingerprint .fa-university").should("be.visible");
cy.get("#fingerprint .fa-btc").should("be.visible");
cy.get("#fingerprint .fa-cutlery").should("be.visible");
cy.get("#fingerprint .fa-subway").should("be.visible");
cy.get("#fingerprint .fa-plane").should("be.visible");
cy.get("#signInButton").click();
cy.wait(500);
cy.get("#siteField").type("lesspass.com");
@@ -22,7 +21,7 @@ describe("Connected Mode", function() {
.click();
cy.get("#signOutButton").should("be.visible");
cy.get("#signOutButton").click();
cy.get(".fa-save").should('not.exist');
cy.get(".fa-save").should("not.exist");
});
it("can log in and log out", function() {
cy.visit("/");
@@ -31,7 +30,6 @@ describe("Connected Mode", function() {
cy.get("#baseURL").should("have.value", "https://lesspass.com");
cy.get("#email").type("test@lesspass.com");
cy.get("#passwordField").type("test@lesspass.com");
cy.get("#encryptMasterPassword__btn").click();
cy.wait(1000);
cy.get("#signInButton").click();
cy.get("#siteField").should("be.visible");
@@ -40,7 +38,7 @@ describe("Connected Mode", function() {
.first()
.click();
cy.get("#signOutButton").click();
cy.get(".fa-key").should('not.exist');
cy.get(".fa-key").should("not.exist");
});
it("reset password page", function() {
cy.visit("/");
@@ -56,7 +54,6 @@ describe("Connected Mode", function() {
cy.get("#baseURL").should("have.value", "https://lesspass.com");
cy.get("#email").type("test@lesspass.com");
cy.get("#passwordField").type("test@lesspass.com");
cy.get("#encryptMasterPassword__btn").click();
cy.wait(500);
cy.get("#signInButton").click();
cy.get(".fa-key").click();


+ 35
- 15
packages/lesspass-pure/src/components/MasterPassword.vue View File

@@ -33,26 +33,45 @@
v-on:input="updateValue($event.target.value)"
v-on:keyup.enter="$emit('keyupEnter')"
/>
<span class="input-group-btn" v-if="fingerprint && value" v-on:click="togglePasswordType">
<span
class="input-group-btn"
v-if="fingerprint && value"
v-on:click="togglePasswordType"
>
<button id="fingerprint" class="btn" type="button" tabindex="-1">
<small>
<i class="fa fa-fw" v-bind:class="[icon1]" v-bind:style="{ color: color1 }"></i>
<i class="fa fa-fw" v-bind:class="[icon2]" v-bind:style="{ color: color2 }"></i>
<i class="fa fa-fw" v-bind:class="[icon3]" v-bind:style="{ color: color3 }"></i>
<i
class="fa fa-fw"
v-bind:class="[icon1]"
v-bind:style="{ color: color1 }"
></i>
<i
class="fa fa-fw"
v-bind:class="[icon2]"
v-bind:style="{ color: color2 }"
></i>
<i
class="fa fa-fw"
v-bind:class="[icon3]"
v-bind:style="{ color: color3 }"
></i>
</small>
</button>
</span>
</div>
<button
id="encryptMasterPassword__btn"
type="button"
class="btn btn-link btn-sm p-0"
v-if="showEncryptButton"
v-on:click="encryptMasterPassword()"
v-bind:class="{'disabled': email === ''}"
>
<small>{{ EncryptButtonText }}</small>
</button>
<small>
<div class="form-check form-switch" v-if="showEncryptButton">
<input
class="form-check-input"
type="checkbox"
id="checkPlainPassword"
v-model="checkPlainPassword"
/>
<label class="form-check-label" for="checkPlainPassword">{{
$t("Use plain password")
}}</label>
</div>
</small>
</div>
</template>
<script>
@@ -80,7 +99,8 @@ export default {
icon3: "",
color1: "",
color2: "",
color3: ""
color3: "",
checkPlainPassword: false
};
},
methods: {


+ 1
- 0
packages/lesspass-pure/src/i18n/en.json View File

@@ -53,6 +53,7 @@
"SorryCopy": "Sorry, copying only works in modern browsers.",
"UpdateYourSearch": "Please try broadening your search.",
"Username": "Username",
"Use plain password": "Use plain password (not recommended)",
"WelcomeRegister": "Welcome, {email}. Thank you for signing up!",
"resetPasswordSuccess": "If the email address {email} is associated with a LessPass account, you will receive an email from LessPass with instructions on how to reset your password."
}

+ 2
- 1
packages/lesspass-pure/src/i18n/fr.json View File

@@ -53,6 +53,7 @@
"SorryCopy": "Nous sommes désolés, la copie ne fonctionne que sur les navigateurs modernes",
"UpdateYourSearch": "Merci de modifier votre recherche.",
"Username": "Nom d'utilisateur",
"Use plain password": "Utiliser le mot de passe en clair (non recommandé)",
"WelcomeRegister": "Bienvenue {email}, merci de vous être enregistré.",
"resetPasswordSuccess": "Si l'adresse email {email} est associée avec un compte LessPass, vous allez recevoir un email de la part de LessPass avec les instructions pour changer votre mot de passe."
}
}

+ 38
- 21
packages/lesspass-pure/src/views/Login.vue View File

@@ -76,6 +76,18 @@ import User from "../api/user";
import { defaultbaseURL } from "../api/default";
import MasterPassword from "../components/MasterPassword.vue";
import message from "../services/message";
import LessPass from "lesspass";
import defaultPasswordProfile from "../store/defaultPassword";

function encryptPassword(email, password) {
return LessPass.generatePassword(
"lesspass.com",
email,
password,
defaultPasswordProfile
);
return res;
}

export default {
data() {
@@ -104,28 +116,33 @@ export default {
signIn() {
if (this.formIsValid()) {
const baseURL = this.baseURL;
let checkPlainPassword = this.$children[0].checkPlainPassword
this.$store.dispatch("setBaseURL", { baseURL });
User.login({ email: this.email, password: this.password })
.then(response => {
this.$store.dispatch("login", response.data);
this.$store.dispatch("cleanMessage");
this.$router.push({ name: "home" });
})
.catch(err => {
if (err.response === undefined && baseURL !== defaultbaseURL) {
message.error(
this.$t("DBNotRunning", "Your LessPass Database is not running")
);
} else if (err.response && err.response.status === 401) {
message.error(
this.$t(
"LoginIncorrectError",
"The email and password you entered did not match our records. Please double-check and try again."
)
);
} else {
message.displayGenericError();
}
encryptPassword(this.email, this.password)
.then(encryptedPassword => {
let pass = checkPlainPassword ? this.password : encryptedPassword;
User.login({ email: this.email, password: pass })
.then(response => {
this.$store.dispatch("login", response.data);
this.$store.dispatch("cleanMessage");
this.$router.push({ name: "home" });
})
.catch(err => {
if (err.response === undefined && baseURL !== defaultbaseURL) {
message.error(
this.$t("DBNotRunning", "Your LessPass Database is not running")
);
} else if (err.response && err.response.status === 401) {
message.error(
this.$t(
"LoginIncorrectError",
"The email and password you entered did not match our records. Please double-check and try again."
)
);
} else {
message.displayGenericError();
}
});
});
}
}


Loading…
Cancel
Save