disable chrome save password dialog

This commit is contained in:
LouisLam 2021-09-07 16:46:42 +08:00
parent 848296b77a
commit 8a4a87716f
1 changed files with 18 additions and 2 deletions

View File

@ -1,6 +1,22 @@
<template> <template>
<div class="input-group mb-3"> <div class="input-group mb-3">
<input v-model="model" :type="visibility" class="form-control" :placeholder="placeholder" :maxlength="maxlength" :autocomplete="autocomplete" :required="required"> <!--
Hack - Disable Chrome save password
readonly + onfocus
https://stackoverflow.com/questions/41217019/how-to-prevent-a-browser-from-storing-passwords
-->
<input
v-model="model"
:type="visibility"
class="form-control"
:placeholder="placeholder"
:maxlength="maxlength"
:autocomplete="autocomplete"
:required="required"
readonly
onfocus="this.removeAttribute('readonly');"
>
<a v-if="visibility == 'password'" class="btn btn-outline-primary" @click="showInput()"> <a v-if="visibility == 'password'" class="btn btn-outline-primary" @click="showInput()">
<font-awesome-icon icon="eye" /> <font-awesome-icon icon="eye" />
</a> </a>
@ -43,7 +59,7 @@ export default {
return this.modelValue return this.modelValue
}, },
set(value) { set(value) {
this.$emit('update:modelValue', value) this.$emit("update:modelValue", value)
} }
} }
}, },