Browse Source

Clean code in PasswordGenerator.vue component

pull/342/head
Guillaume Vincent 6 years ago
parent
commit
ba37141e17
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      src/views/PasswordGenerator.vue

+ 4
- 3
src/views/PasswordGenerator.vue View File

@@ -172,12 +172,13 @@ export default {
this.passwordGenerated = ""; this.passwordGenerated = "";
this.$refs.masterPassword.hidePassword(); this.$refs.masterPassword.hidePassword();
}, },
cleanFormInSeconds(seconds = 15) {
cleanFormIn30Seconds() {
const thirtySecondsInMillisecond = 30 * 1000;
this.cleanTimeout = setTimeout(() => { this.cleanTimeout = setTimeout(() => {
this.masterPassword = ""; this.masterPassword = "";
this.passwordGenerated = ""; this.passwordGenerated = "";
this.$refs.masterPassword.hidePassword(); this.$refs.masterPassword.hidePassword();
}, 1000 * seconds);
}, thirtySecondsInMillisecond);
}, },
generatePassword() { generatePassword() {
const site = this.password.site; const site = this.password.site;
@@ -209,7 +210,7 @@ export default {
passwordProfile passwordProfile
).then(passwordGenerated => { ).then(passwordGenerated => {
this.passwordGenerated = passwordGenerated; this.passwordGenerated = passwordGenerated;
this.cleanFormInSeconds(30);
this.cleanFormIn30Seconds();
}); });
}, },
focusBestInputField() { focusBestInputField() {


Loading…
Cancel
Save