better autocomplete for password and token inputs (#2505)

This commit is contained in:
Rizvan Nukhtarov 2024-08-30 10:16:34 +03:00 committed by GitHub
parent c0b88fe736
commit 5d7de0858c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -416,19 +416,19 @@
<a-col span="24"> <a-col span="24">
<a-form> <a-form>
<a-form-item> <a-form-item>
<a-input autocomplete="username" v-model.trim="user.username" placeholder='{{ i18n "username" }}' <a-input autocomplete="username" name="username" v-model.trim="user.username" placeholder='{{ i18n "username" }}'
@keydown.enter.native="login" autofocus> @keydown.enter.native="login" autofocus>
<a-icon slot="prefix" type="user" style="font-size: 16px;"></a-icon> <a-icon slot="prefix" type="user" style="font-size: 16px;"></a-icon>
</a-input> </a-input>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<password-input autocomplete="current-password" icon="lock" v-model.trim="user.password" <password-input autocomplete="password" name="password" icon="lock" v-model.trim="user.password"
placeholder='{{ i18n "password" }}' placeholder='{{ i18n "password" }}'
@keydown.enter.native="login"> @keydown.enter.native="login">
</password-input> </password-input>
</a-form-item> </a-form-item>
<a-form-item v-if="secretEnable"> <a-form-item v-if="secretEnable">
<password-input autocomplete="secret" icon="key" v-model.trim="user.loginSecret" <password-input autocomplete="secret" name="secret" icon="key" v-model.trim="user.loginSecret"
placeholder='{{ i18n "secretToken" }}' placeholder='{{ i18n "secretToken" }}'
@keydown.enter.native="login"> @keydown.enter.native="login">
</password-input> </password-input>

View file

@ -1,8 +1,10 @@
{{define "component/passwordInput"}} {{define "component/passwordInput"}}
<template> <template>
<a-input :value="value" :type="showPassword ? 'text' : 'password'" <a-input :value="value" :type="showPassword ? 'text' : 'password'"
:placeholder="placeholder" :placeholder="placeholder"
@input="$emit('input', $event.target.value)"> :autocomplete="autocomplete"
:name="name"
@input="$emit('input', $event.target.value)">
<template v-if="icon" #prefix> <template v-if="icon" #prefix>
<a-icon :type="icon" style="font-size: 16px;" /> <a-icon :type="icon" style="font-size: 16px;" />
</template> </template>
@ -18,7 +20,7 @@
{{define "component/password"}} {{define "component/password"}}
<script> <script>
Vue.component('password-input', { Vue.component('password-input', {
props: ["title", "value", "placeholder", "icon"], props: ["title", "value", "placeholder", "icon", "autocomplete", "name"],
template: `{{template "component/passwordInput"}}`, template: `{{template "component/passwordInput"}}`,
data() { data() {
return { return {