瀏覽代碼

fix #19 credentials are not reset after some time

pull/342/head
Guillaume Vincent 8 年之前
父節點
當前提交
c37c3e7576
共有 1 個文件被更改,包括 21 次插入5 次删除
  1. +21
    -5
      src/views/PasswordGenerator.vue

+ 21
- 5
src/views/PasswordGenerator.vue 查看文件

@@ -106,6 +106,7 @@
<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>
@@ -183,8 +184,7 @@
this.generatedPassword = '';
return;
}
const password = new Password(this.password);
return lesspass.renderPassword(this.encryptedLogin, this.password.site, password.options);
return this.generatePassword();
}
},
preFetch: fetchPasswords,
@@ -198,9 +198,7 @@
}

var clipboard = new Clipboard('#copyPasswordButton');
var vm = this;
clipboard.on('success', event => {
vm.$store.dispatch('PASSWORD_GENERATED');
if (event.text) {
showTooltip(event.trigger, 'copied !');
}
@@ -210,7 +208,8 @@
return {
masterPassword: '',
encryptedLogin: '',
generatedPassword: ''
generatedPassword: '',
cleanTimeout: null
}
},
watch: {
@@ -239,6 +238,9 @@
'masterPassword': function () {
this.encryptedLogin = '';
this.encryptLogin();
},
'generatedPassword': function () {
this.cleanFormInSeconds(30);
}
},
methods: {
@@ -255,6 +257,20 @@
} else {
this.$refs.masterPassword.type = 'password';
}
},
generatePassword(){
const password = new Password(this.password);
const generatedPassword = lesspass.renderPassword(this.encryptedLogin, this.password.site, password.options);
this.$store.dispatch('PASSWORD_GENERATED');
return generatedPassword;
},
cleanFormInSeconds(seconds){
clearTimeout(this.cleanTimeout);
this.cleanTimeout = setTimeout(() => {
this.masterPassword = '';
this.encryptedLogin = '';
this.generatedPassword = '';
}, 1000 * seconds);
}
}
}


Loading…
取消
儲存