Browse Source

Generate password when hitting Enter

fix https://github.com/lesspass/lesspass/issues/141
pull/342/head
Guillaume Vincent 7 years ago
parent
commit
7343d66f02
2 changed files with 16 additions and 6 deletions
  1. +9
    -3
      src/components/MasterPassword.vue
  2. +7
    -3
      src/views/PasswordGenerator.vue

+ 9
- 3
src/components/MasterPassword.vue View File

@@ -12,7 +12,8 @@
autocorrect="off" autocorrect="off"
autocapitalize="off" autocapitalize="off"
v-model="password" v-model="password"
v-on:input="updatePassword($event.target.value)">
v-on:input="updatePassword($event.target.value)"
v-on:keyup.enter="triggerEnterMethod">
<fingerprint v-bind:fingerprint="fingerprint" v-on:click.native="togglePasswordType($refs.password)"> <fingerprint v-bind:fingerprint="fingerprint" v-on:click.native="togglePasswordType($refs.password)">
</fingerprint> </fingerprint>
</div> </div>
@@ -23,9 +24,9 @@


export default { export default {
components: { components: {
Fingerprint,
Fingerprint
}, },
props: ['value'],
props: ['value', 'keyupEnter'],
data(){ data(){
return { return {
fingerprint: '', fingerprint: '',
@@ -53,6 +54,11 @@
} else { } else {
element.type = 'password'; element.type = 'password';
} }
},
triggerEnterMethod(){
if (typeof this.keyupEnter !== undefined) {
this.keyupEnter()
}
} }
} }
} }


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

@@ -71,7 +71,7 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<master-password v-model="masterPassword"></master-password>
<master-password v-model="masterPassword" :keyupEnter="generatePassword"></master-password>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<div class="col-9" v-show="generatedPassword"> <div class="col-9" v-show="generatedPassword">
@@ -140,7 +140,9 @@
</div> </div>
<div class="form-group row" v-if="showOptions"> <div class="form-group row" v-if="showOptions">
<div class="col-6 col-sm-4"> <div class="col-6 col-sm-4">
<label for="passwordLength"><small>Length</small></label>
<label for="passwordLength">
<small>Length</small>
</label>
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<span class="input-group-btn" v-on:click.prevent="decrementPasswordLength"> <span class="input-group-btn" v-on:click.prevent="decrementPasswordLength">
<button class="btn btn-secondary" type="button" tabindex="-1"> <button class="btn btn-secondary" type="button" tabindex="-1">
@@ -157,7 +159,9 @@
</div> </div>
</div> </div>
<div class="col-6 col-sm-4"> <div class="col-6 col-sm-4">
<label for="passwordCounter"><small>Counter</small></label>
<label for="passwordCounter">
<small>Counter</small>
</label>
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<span class="input-group-btn" v-on:click.prevent="decrementCounter"> <span class="input-group-btn" v-on:click.prevent="decrementCounter">
<button class="btn btn-secondary" type="button" tabindex="-1"> <button class="btn btn-secondary" type="button" tabindex="-1">


Loading…
Cancel
Save