mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-10 12:42:55 +08:00
prevent Chrome ask for saving password for notification settings (change to one-time-code to solve it)
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
<template>
|
||||
<div class="input-group mb-3">
|
||||
<!--
|
||||
Hack - Disable Chrome save password
|
||||
readonly + onfocus
|
||||
https://stackoverflow.com/questions/41217019/how-to-prevent-a-browser-from-storing-passwords
|
||||
-->
|
||||
<input
|
||||
ref="input"
|
||||
v-model="model"
|
||||
:type="visibility"
|
||||
class="form-control"
|
||||
@@ -13,8 +9,7 @@
|
||||
:maxlength="maxlength"
|
||||
:autocomplete="autocomplete"
|
||||
:required="required"
|
||||
:readonly="isReadOnly"
|
||||
@focus="removeReadOnly"
|
||||
:readonly="readonly"
|
||||
>
|
||||
|
||||
<a v-if="visibility == 'password'" class="btn btn-outline-primary" @click="showInput()">
|
||||
@@ -42,20 +37,20 @@ export default {
|
||||
default: 255
|
||||
},
|
||||
autocomplete: {
|
||||
type: Boolean,
|
||||
type: String,
|
||||
default: undefined,
|
||||
},
|
||||
required: {
|
||||
type: Boolean
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
type: String,
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visibility: "password",
|
||||
readOnlyValue: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -66,22 +61,10 @@ export default {
|
||||
set(value) {
|
||||
this.$emit("update:modelValue", value)
|
||||
}
|
||||
},
|
||||
isReadOnly() {
|
||||
// Actually readonly from prop
|
||||
if (this.readonly) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Hack - Disable Chrome save password
|
||||
return this.readOnlyValue;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// Hack - Disable Chrome save password
|
||||
if (this.autocomplete) {
|
||||
this.readOnlyValue = "readonly";
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
showInput() {
|
||||
@@ -90,13 +73,6 @@ export default {
|
||||
hideInput() {
|
||||
this.visibility = "password";
|
||||
},
|
||||
|
||||
// Hack - Disable Chrome save password
|
||||
removeReadOnly() {
|
||||
if (this.autocomplete) {
|
||||
this.readOnlyValue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user