@@ -39,7 +39,7 @@ If you are working on the CLI, you will need: | |||||
Here are some folders that worth noticing: | 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`. | * `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-web-extension` contains the code specific for the web extension. | ||||
* `lesspass-render-password` contains the algorithm to generate passwords. | * `lesspass-render-password` contains the algorithm to generate passwords. | ||||
* `cli` contains the command line version. Development is done with `python`. | * `cli` contains the command line version. Development is done with `python`. | ||||
@@ -43,16 +43,14 @@ | |||||
</button> | </button> | ||||
</span> | </span> | ||||
</div> | </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> | </div> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
@@ -70,7 +68,8 @@ export default { | |||||
type: Boolean, | type: Boolean, | ||||
default: false | default: false | ||||
}, | }, | ||||
EncryptButtonText: String | |||||
EncryptButtonText: String, | |||||
PlainCheckboxText: String | |||||
}, | }, | ||||
data() { | data() { | ||||
return { | return { | ||||
@@ -52,7 +52,7 @@ | |||||
"SiteLoginMasterPasswordMandatory": "Site, login, and master password fields are mandatory.", | "SiteLoginMasterPasswordMandatory": "Site, login, and master password fields are mandatory.", | ||||
"SorryCopy": "Sorry, copying only works in modern browsers.", | "SorryCopy": "Sorry, copying only works in modern browsers.", | ||||
"UpdateYourSearch": "Please try broadening your search.", | "UpdateYourSearch": "Please try broadening your search.", | ||||
"Username": "Username", | |||||
"Use plain password": "Use plain password (not recommended)", | |||||
"WelcomeRegister": "Welcome, {email}. Thank you for signing up!", | "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." | "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." | ||||
} | } |
@@ -52,7 +52,7 @@ | |||||
"SiteLoginMasterPasswordMandatory": "Les champs site, login et mot de passe fort sont obligatoires.", | "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", | "SorryCopy": "Nous sommes désolés, la copie ne fonctionne que sur les navigateurs modernes", | ||||
"UpdateYourSearch": "Merci de modifier votre recherche.", | "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é.", | "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." | "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." | ||||
} | |||||
} |
@@ -37,6 +37,7 @@ | |||||
v-bind:email="email" | v-bind:email="email" | ||||
v-bind:showEncryptButton="true" | v-bind:showEncryptButton="true" | ||||
v-bind:EncryptButtonText="$t('Encrypt my master password')" | v-bind:EncryptButtonText="$t('Encrypt my master password')" | ||||
v-bind:PlainCheckboxText="$t('Use plain password')" | |||||
></master-password> | ></master-password> | ||||
</div> | </div> | ||||
<div class="form-group"> | <div class="form-group"> | ||||
@@ -77,6 +78,18 @@ import { defaultbaseURL } from "../api/default"; | |||||
import MasterPassword from "../components/MasterPassword.vue"; | import MasterPassword from "../components/MasterPassword.vue"; | ||||
import message from "../services/message"; | 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 { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
@@ -105,27 +118,31 @@ export default { | |||||
if (this.formIsValid()) { | if (this.formIsValid()) { | ||||
const baseURL = this.baseURL; | const baseURL = this.baseURL; | ||||
this.$store.dispatch("setBaseURL", { 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(); | |||||
} | |||||
}); | |||||
}); | }); | ||||
} | } | ||||
} | } | ||||