Bläddra i källkod

use lesspass core v6

pull/342/head
Guillaume Vincent 8 år sedan
förälder
incheckning
0134dc407a
10 ändrade filer med 16277 tillägg och 28797 borttagningar
  1. +16061
    -28602
      dist/lesspass.js
  2. +1
    -1
      dist/lesspass.min.css
  3. +11
    -17
      dist/lesspass.min.js
  4. +3
    -1
      index.html
  5. +9
    -4
      package.json
  6. +2
    -2
      src/LessPass.vue
  7. +3
    -3
      src/components/Menu.vue
  8. +20
    -6
      src/store.js
  9. +5
    -2
      src/views/Login.vue
  10. +162
    -159
      src/views/PasswordGenerator.vue

+ 16061
- 28602
dist/lesspass.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 1
- 1
dist/lesspass.min.css
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 11
- 17
dist/lesspass.min.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 3
- 1
index.html Visa fil

@@ -8,7 +8,9 @@
<link rel="stylesheet" href="dist/lesspass.min.css">
</head>
<body>
<div id="lesspass"></div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-5 offset-lg-4">
<div id="lesspass"></div>
</div>
<script src="dist/lesspass.min.js"></script>
</body>
</html>

+ 9
- 4
package.json Visa fil

@@ -22,15 +22,20 @@
},
"dependencies": {
"axios": "^0.15.2",
"babel-core": "^6.18.2",
"babel-loader": "^6.2.7",
"bootstrap": "4.0.0-alpha.5",
"clipboard": "^1.5.15",
"font-awesome": "^4.7.0",
"hint.css": "^2.4.0",
"hint.css": "^2.4.1",
"jwt-decode": "^2.1.0",
"lesspass": "^5.1.0",
"lesspass": "^6.0.0-beta.6",
"lodash.debounce": "^4.0.8",
"vue": "^2.0.3",
"vue-router": "^2.0.1",
"nock": "^9.0.2",
"primer-css": "^4.3.0",
"vue": "^2.0.7",
"vue-loader": "^9.9.5",
"vue-router": "^2.0.2",
"vuex": "^2.0.0"
},
"devDependencies": {


+ 2
- 2
src/LessPass.vue Visa fil

@@ -13,9 +13,9 @@
}
</style>
<template>
<div id="lesspass" class="card" style="border:none;">
<div id="lesspass" class="card" style="max-width: 475px;">
<lesspass-menu></lesspass-menu>
<div class="card-block" style="min-height: 400px;">
<div class="card-block">
<router-view></router-view>
</div>
</div>


+ 3
- 3
src/components/Menu.vue Visa fil

@@ -1,7 +1,6 @@
<style>
.card-header-dark {
background-color: #555;
border-color: #555;
color: #FFF;
}

@@ -52,7 +51,7 @@
</div>
</div>
</div>
<div class="card-header card-header-dark" v-show="isGuest">
<div class="card-header" v-bind:class="{ 'card-warning': version===1, 'card-primary': version===2 }" v-show="isGuest">
<div class="row">
<div class="index-header">
<div class="col-xs-6">
@@ -85,7 +84,8 @@
'isAuthenticated',
'isGuest',
'email',
'passwordStatus'
'passwordStatus',
'version'
])
}
</script>

+ 20
- 6
src/store.js Visa fil

@@ -20,18 +20,26 @@ const defaultPassword = {
numbers: true,
symbols: true,
length: 12,
counter: 1,
counter: 1
};
function getDefaultPasswordProfile(version) {
if (version === 1) {
return Object.assign({}, defaultPassword, {version: 1, length: 12});
}
if (version === 2) {
return Object.assign({}, defaultPassword, {version: 2, length: 16});
}
}

const versionLoadedByDefault = 1;
const state = {
authenticated: auth.isAuthenticated(),
email: '',
passwordStatus: 'CLEAN',
passwords: [],
baseURL: 'https://lesspass.com',
password: {
...defaultPassword
}
password: getDefaultPasswordProfile(versionLoadedByDefault),
version: versionLoadedByDefault
};

const mutations = {
@@ -77,7 +85,12 @@ const mutations = {
},
UPDATE_EMAIL(state, {email}){
state.email = email
}
},
CHANGE_VERSION(state, {version}){
state.password = getDefaultPasswordProfile(version);
state.version = version;
storage.save({version});
},
};

const actions = {
@@ -140,7 +153,8 @@ const getters = {
isAuthenticated: state => state.authenticated,
isGuest: state => !state.authenticated,
passwordStatus: state => state.passwordStatus,
email: state => state.email
email: state => state.email,
version: state => state.version,
};

export default new Vuex.Store({


+ 5
- 2
src/views/Login.vue Visa fil

@@ -40,7 +40,8 @@
<label class="form-check-label">
<input type="checkbox" class="form-check-input" v-model="useMasterPassword">
Check me if you want to use your master password here.
<span class="tag tag-warning" v-on:click.prevent="seeMasterPasswordHelp=!seeMasterPasswordHelp">
<span class="tag tag-warning"
v-on:click.prevent="seeMasterPasswordHelp=!seeMasterPasswordHelp">
?
</span>
<span class="text-warning" v-if="seeMasterPasswordHelp">
@@ -73,7 +74,8 @@
</div>
<div class="form-group row">
<div class="col-xs-12">
<button id="signInButton" class="btn btn-primary" type="button" v-on:click="signIn">
<button id="signInButton" class="btn" type="button" v-on:click="signIn"
v-bind:class="{ 'btn-warning': version===1, 'btn-primary': version===2 }">
<span v-if="loadingSignIn"><i class="fa fa-spinner fa-pulse fa-fw"></i></span>
Sign In
</button>
@@ -212,6 +214,7 @@
},
},
computed: {
...mapGetters(['version']),
baseURL: {
get () {
return this.$store.state.baseURL


+ 162
- 159
src/views/PasswordGenerator.vue Visa fil

@@ -32,125 +32,134 @@
</style>
<template>
<form id="password-generator">
<div class="form-group row">
<div class="col-xs-12">
<div class="inner-addon left-addon">
<i class="fa fa-globe"></i>
<input id="site"
name="site"
type="text"
ref="site"
class="form-control"
placeholder="Site"
list="savedSites"
autocorrect="off"
autocapitalize="none"
v-model="password.site">
<datalist id="savedSites">
<option v-for="pwd in passwords">
{{pwd.site}} | {{pwd.login}}
</option>
</datalist>
</div>
<div class="form-group">
<div class="inner-addon left-addon">
<label for="site" class="sr-only">Site</label>
<i class="fa fa-globe"></i>
<input id="site"
name="site"
type="text"
ref="site"
class="form-control"
placeholder="Site"
list="savedSites"
autocorrect="off"
autocapitalize="none"
v-model="password.site">
<datalist id="savedSites">
<option v-for="pwd in passwords">
{{pwd.site}} | {{pwd.login}}
</option>
</datalist>
</div>
</div>
<remove-auto-complete></remove-auto-complete>
<div class="form-group row">
<div class="col-xs-12">
<div class="inner-addon left-addon">
<i class="fa fa-user"></i>
<label for="login" class="sr-only">Login</label>
<input id="login"
name="login"
type="text"
class="form-control"
placeholder="Login"
autocomplete="off"
autocorrect="off"
autocapitalize="none"
v-model="password.login">
</div>
<div class="form-group">
<div class="inner-addon left-addon">
<label for="login" class="sr-only">Login</label>
<i class="fa fa-user"></i>
<input id="login"
name="login"
type="text"
class="form-control"
placeholder="Login"
autocomplete="off"
autocorrect="off"
autocapitalize="none"
v-model="password.login">
</div>
</div>
<div class="form-group row">
<div class="col-xs-12">
<div class="inner-addon left-addon input-group">
<label for="masterPassword" class="sr-only">Password</label>
<i class="fa fa-lock"></i>
<input id="masterPassword"
name="masterPassword"
ref="masterPassword"
type="password"
class="form-control"
placeholder="Master password"
autocomplete="new-password"
autocorrect="off"
autocapitalize="none"
v-model="masterPassword">
<fingerprint :fingerprint="fingerprint" v-on:click.native="showMasterPassword"></fingerprint>
</div>
<div class="form-group">
<div class="inner-addon left-addon input-group">
<label for="masterPassword" class="sr-only">Master Password</label>
<i class="fa fa-lock"></i>
<input id="masterPassword"
name="masterPassword"
ref="masterPassword"
type="password"
class="form-control"
placeholder="Master password"
autocomplete="new-password"
autocorrect="off"
autocapitalize="none"
v-model="masterPassword">
<fingerprint :fingerprint="fingerprint" v-on:click.native="showMasterPassword"></fingerprint>
</div>
</div>
<div class="form-group row">
<div class="col-xs-12">
<div class="input-group">
<label for="generatedPassword" class="sr-only">Password Generated</label>
<input id="generatedPassword"
name="generatedPassword"
type="text"
class="form-control"
tabindex="-1"
readonly
v-model="generatedPassword">
<span class="input-group-btn">
<button id="copyPasswordButton" class="btn-copy btn btn-primary"
:disabled="!generatedPassword"
type="button"
v-on:click="cleanFormInSeconds(10)"
data-clipboard-target="#generatedPassword">
<i class="fa fa-clipboard white"></i> Copy
</button>
</span>
</div>
</div>
<div class="form-group">
<button id="copyPasswordButton" type="button" class="btn" data-clipboard-text="" v-show="showCopyBtn"
v-bind:class="{ 'btn-warning': password.version===1, 'btn-primary': password.version===2 }">
Copy to clipboard
</button>
<button type="button" class="btn btn-secondary" v-show="!showCopyBtn" v-on:click="renderPassword">
Generate Password
</button>
<button type="button" class="btn btn-secondary" v-on:click="showOptions=!showOptions">
<i class="fa fa-cog" aria-hidden="true"></i> Options
</button>
</div>
<div class="form-group row">
<div class="col-xs-12">
Password options
<hr style="margin:0;">
</div>
<div class="form-group" v-if="showOptions">
<label class="form-check-inline">
<input class="form-check-input" type="checkbox" id="lowercase"
v-model="password.lowercase"> abc
</label>
<label class="form-check-inline">
<input class="form-check-input" type="checkbox" id="uppercase"
v-model="password.uppercase"> ABC
</label>
<label class="form-check-inline">
<input class="form-check-input" type="checkbox" id="numbers"
v-model="password.numbers">
123
</label>
<label class="form-check-inline">
<input class="form-check-input" type="checkbox" id="symbols"
v-model="password.symbols">
%!@
</label>
</div>
<div class="form-group row">
<div class="col-xs-12">
<label class="form-check-inline">
<input class="form-check-input" type="checkbox" id="lowercase"
v-model="password.lowercase"> abc
</label>
<label class="form-check-inline">
<input class="form-check-input" type="checkbox" id="uppercase"
v-model="password.uppercase"> ABC
<div class="form-group row" v-if="showOptions">
<div class="col-xs-12 col-sm-4 pb-1">
<label for="passwordLength">
Password Length
</label>
<label class="form-check-inline">
<input class="form-check-input" type="checkbox" id="numbers"
v-model="password.numbers">
123
<input class="form-control" type="number" id="passwordLength" v-model="password.length" min="6">
</div>
<div class="col-xs-12 col-sm-4 pb-1">
<label for="passwordLength">
Counter
</label>
<label class="form-check-inline">
<input class="form-check-input" type="checkbox" id="symbols"
v-model="password.symbols">
%!@
<input class="form-control" type="number" id="passwordCounter" v-model="password.counter" min="1">
</div>
<div class="col-xs-12 col-sm-4 pb-1">
<label for="version">
Version
</label>
<select id="version" v-model="password.version" v-on:change="selectVersion" class="form-control">
<option value="1">V1</option>
<option value="2">V2</option>
</select>
</div>
</div>
<div class="form-group row">
<label for="passwordLength" class="col-xs-3 col-form-label">Length</label>
<div class="col-xs-3 pl-0">
<input class="form-control" type="number" id="passwordLength" v-model="password.length"
min="6">
<div class="form-group" v-if="showError">
<div class="alert alert-danger" role="alert">
site, login and master password fields are mandatory
</div>
<label for="passwordCounter" class="col-xs-3 col-form-label">Counter</label>
<div class="col-xs-3 pl-0">
<input class="form-control" type="number" id="passwordCounter" v-model="password.counter" min="1">
</div>
<div class="form-group" v-if="version === 2 && password.version ===1 && !showError">
<div class="alert alert-warning" role="alert">
This is a password in version&nbsp;1.
You should update your password and use version&nbsp;2
<br>
<a href="#" v-on:click.prevent="showOptions=!showOptions" v-if="!showOptions"> show me the options</a>
</div>
</div>
<div class="form-group" v-if="version === 1 && !showError">
<div class="alert alert-warning" role="alert">
You are using LessPass <strong>version&nbsp;1</strong> which is deprecated.
We will load the <strong>version&nbsp;2</strong> by default on january 1st, 2017.
<br>You can still use version 1 in options after this period.
<br> <a href="#" v-on:click.prevent="changeVersion(2)">Use version 2 now</a>
</div>
</div>
</form>
@@ -177,7 +186,7 @@
RemoveAutoComplete,
Fingerprint
},
computed: mapGetters(['passwords', 'password']),
computed: mapGetters(['passwords', 'password', 'version']),
preFetch: fetchPasswords,
beforeMount () {
const id = this.$route.params.id;
@@ -197,19 +206,28 @@
clipboard.on('success', event => {
if (event.text) {
showTooltip(event.trigger, 'copied !');
setTimeout(()=> {
this.showCopyBtn = false;
this.cleanFormInSeconds(8);
}, 2000);
}
});
},
data(){
return {
masterPassword: '',
encryptedLogin: '',
fingerprint: '',
generatedPassword: '',
cleanTimeout: null
cleanTimeout: null,
showOptions: false,
showCopyBtn: false,
showError: false
}
},
watch: {
'masterPassword': function () {
this.showCopyBtn = false;
this.showFingerprint();
},
'password.site': function (newValue) {
const values = newValue.split(" | ");
if (values.length === 2) {
@@ -225,49 +243,12 @@
}
}
}
this.renderPassword();
},
'password.login': function () {
this.encryptedLogin = '';
this.encryptLogin();
},
'password.uppercase': function () {
this.renderPassword();
},
'password.lowercase': function () {
this.renderPassword();
},
'password.numbers': function () {
this.renderPassword();
},
'password.symbols': function () {
this.renderPassword();
},
'password.length': function () {
this.renderPassword();
},
'password.counter': function () {
this.renderPassword();
},
'masterPassword': function () {
this.encryptedLogin = '';
this.encryptLogin();
},
'encryptedLogin': function () {
this.renderPassword();
},
'generatedPassword': function () {
this.cleanFormInSeconds(30);
},
}
},
methods: {
encryptLogin: debounce(function () {
if (this.password.login && this.masterPassword) {
LessPass.encryptLogin(this.password.login, this.masterPassword).then(encryptedLogin => {
this.encryptedLogin = encryptedLogin;
});
}
}, 500),
showFingerprint: debounce(function () {
this.fingerprint = this.masterPassword;
}, 3000),
showMasterPassword(){
if (this.$refs.masterPassword.type === 'password') {
this.$refs.masterPassword.type = 'text';
@@ -280,23 +261,45 @@
this.cleanTimeout = setTimeout(() => {
this.$store.commit('PASSWORD_CLEAN');
this.masterPassword = '';
this.encryptedLogin = '';
this.generatedPassword = '';
this.fingerprint = '';
}, 1000 * seconds);
},
renderPassword(){
if (!this.encryptedLogin || !this.password.site) {
this.generatedPassword = '';
clearTimeout(this.cleanTimeout);
var site = this.password.site;
var login = this.password.login;
var masterPassword = this.masterPassword;

if (!site || !login || !masterPassword) {
this.showError = true;
return;
}

this.showError = false;
this.fingerprint = this.masterPassword;
const password = new Password(this.password);
LessPass.renderPassword(this.encryptedLogin, this.password.site, password.options)
.then(generatedPassword => {
this.$store.dispatch('PASSWORD_GENERATED');
this.generatedPassword = generatedPassword;
});

var passwordProfile = {
lowercase: this.password.lowercase,
uppercase: this.password.uppercase,
numbers: this.password.numbers,
symbols: this.password.symbols,
length: this.password.length,
counter: this.password.counter,
version: this.password.version || this.version,
};
return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(generatedPassword => {
window.document.getElementById('copyPasswordButton').setAttribute('data-clipboard-text', generatedPassword);
this.showCopyBtn = !this.showCopyBtn;
this.$store.dispatch('PASSWORD_GENERATED');
}).catch(err => {
console.log(err)
});
},
changeVersion(version){
this.$store.commit('CHANGE_VERSION', {version});
},
selectVersion(event){
this.password.version = parseInt(event.target.value);
}
}
}


Laddar…
Avbryt
Spara