Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(login): optimize autocomplete #3167

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ To set up for local development, follow these steps:
3. To start the development server, run:

```shell
pnpm serve
pnpm dev
```

4. For production compilation and minification:
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/views/Base/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
v-model.trim="record.username"
:placeholder="$t('Base.username')"
tabindex="1"
autocomplete="username"
/>
</el-form-item>
<el-form-item prop="password">
Expand All @@ -41,6 +42,7 @@
type="password"
:placeholder="$t('Base.password')"
tabindex="2"
autocomplete="current-password"
/>
</el-form-item>
<el-form-item>
Expand Down Expand Up @@ -92,13 +94,15 @@
:rules="pwdRules"
@keyup.enter="submitNewPwd"
>
<el-input class="username-placeholder" v-model.trim="record.username" />
<el-form-item prop="password">
<el-input
v-model.trim="newPasswordRecord.password"
autofocus
show-password
tabindex="1"
type="password"
autocomplete="new-password"
:placeholder="t('General.newPassword')"
/>
</el-form-item>
Expand All @@ -108,6 +112,7 @@
show-password
tabindex="2"
type="password"
autocomplete="new-password"
:placeholder="t('General.confirmPassword')"
/>
</el-form-item>
Expand Down Expand Up @@ -414,6 +419,10 @@ const submitNewPwd = async () => {
}
}

.username-placeholder {
display: none;
}

.password-form {
.el-form-item {
margin-bottom: 30px;
Expand Down
13 changes: 10 additions & 3 deletions src/views/General/Users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
accessType === 'edit'
? tl('editorUser')
: accessType === 'chPass'
? tl('changePassword')
: tl('creatingUser')
? tl('changePassword')
: tl('creatingUser')
"
v-model="dialogVisible"
destroy-on-close
Expand Down Expand Up @@ -66,6 +66,7 @@
/>
</el-form-item>
<div v-if="accessType === 'chPass'">
<el-input class="username-placeholder" v-model="record.username" disabled />
<el-form-item prop="newPassword" :label="tl('newPassword')">
<el-input
v-model="record.newPassword"
Expand Down Expand Up @@ -239,7 +240,7 @@ const save = async () => {
await updateUser(username, record.value)
ElMessage.success(t('Base.updateSuccess'))
} else if (accessType.value === 'chPass') {
let pass = {
const pass = {
new_pwd: record.value.newPassword,
old_pwd: record.value.password,
}
Expand Down Expand Up @@ -284,3 +285,9 @@ onBeforeMount(async () => {
await loadData()
})
</script>

<style lang="scss" scoped>
.username-placeholder {
display: none;
}
</style>
Loading