Add confirm password field on registration
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Successful in 56s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 21:13:27 +00:00
parent 43f57c55f5
commit cd833a6232

View File

@@ -29,6 +29,14 @@
class="login-input" class="login-input"
@keydown.enter="submit" @keydown.enter="submit"
/> />
<input
v-if="mode === 'register'"
v-model="confirmPassword"
type="password"
placeholder="确认密码"
class="login-input"
@keydown.enter="submit"
/>
<input <input
v-if="mode === 'register'" v-if="mode === 'register'"
v-model="displayName" v-model="displayName"
@@ -61,6 +69,7 @@ const ui = useUiStore()
const mode = ref('login') const mode = ref('login')
const username = ref('') const username = ref('')
const password = ref('') const password = ref('')
const confirmPassword = ref('')
const displayName = ref('') const displayName = ref('')
const errorMsg = ref('') const errorMsg = ref('')
const loading = ref(false) const loading = ref(false)
@@ -76,6 +85,10 @@ async function submit() {
errorMsg.value = '请输入密码' errorMsg.value = '请输入密码'
return return
} }
if (mode.value === 'register' && password.value !== confirmPassword.value) {
errorMsg.value = '两次输入的密码不一致'
return
}
loading.value = true loading.value = true
try { try {