Quellcode durchsuchen

feat: encrypt master password by default

pull/604/head
Andrea PIERRÉ vor 3 Jahren
Ursprung
Commit
1549d40ec5
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden GPG-Schlüssel-ID: 78A39B4A078E6C06
5 geänderte Dateien mit 52 neuen und 36 gelöschten Zeilen
  1. +1
    -1
      CONTRIBUTING.md
  2. +10
    -11
      packages/lesspass-pure/src/components/MasterPassword.vue
  3. +1
    -1
      packages/lesspass-pure/src/i18n/en.json
  4. +2
    -2
      packages/lesspass-pure/src/i18n/fr.json
  5. +38
    -21
      packages/lesspass-pure/src/views/Login.vue

+ 1
- 1
CONTRIBUTING.md Datei anzeigen

@@ -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`.


+ 10
- 11
packages/lesspass-pure/src/components/MasterPassword.vue Datei anzeigen

@@ -43,16 +43,14 @@
</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="flexSwitchCheckChecked"
v-bind:disabled="email === ''">
<label class="form-check-label" for="flexSwitchCheckChecked">{{ PlainCheckboxText }}</label>
</div>
</small>
</div>
</template>
<script>
@@ -70,7 +68,8 @@ export default {
type: Boolean,
default: false
},
EncryptButtonText: String
EncryptButtonText: String,
PlainCheckboxText: String
},
data() {
return {


+ 1
- 1
packages/lesspass-pure/src/i18n/en.json Datei anzeigen

@@ -52,7 +52,7 @@
"SiteLoginMasterPasswordMandatory": "Site, login, and master password fields are mandatory.",
"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
- 2
packages/lesspass-pure/src/i18n/fr.json Datei anzeigen

@@ -52,7 +52,7 @@
"SiteLoginMasterPasswordMandatory": "Les champs site, login et mot de passe fort sont obligatoires.",
"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 Datei anzeigen

@@ -37,6 +37,7 @@
v-bind:email="email"
v-bind:showEncryptButton="true"
v-bind:EncryptButtonText="$t('Encrypt my master password')"
v-bind:PlainCheckboxText="$t('Use plain password')"
></master-password>
</div>
<div class="form-group">
@@ -77,6 +78,18 @@ 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 encryptPass(email, password) {
return LessPass.generatePassword(
"lesspass.com",
email,
password,
defaultPasswordProfile
);
return res;
}

export default {
data() {
return {
@@ -105,27 +118,31 @@ export default {
if (this.formIsValid()) {
const baseURL = this.baseURL;
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();
}
let pass = encryptPass(this.email, this.password)
.then(pass => {
pass = document.getElementById("flexSwitchCheckChecked").checked ? this.password : pass;
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();
}
});
});
}
}


Laden…
Abbrechen
Speichern