fix(auth): 完善权限控制与强制改密流程

This commit is contained in:
xy
2026-09-17 16:33:09 +08:00
parent 81922d774f
commit 61b4b19f55
22 changed files with 618 additions and 59 deletions
+19 -2
View File
@@ -17,6 +17,7 @@ const captchaCode = ref('')
const captchaLoading = ref(false)
const errorMessage = ref('')
const isSubmitting = ref(false)
const passwordChanged = route.query.passwordChanged === '1'
async function loadCaptcha() {
captchaLoading.value = true
@@ -68,9 +69,11 @@ async function handleLogin() {
: {}),
}
await loginStore.login(payload)
const session = await loginStore.login(payload)
await router.replace(getRedirectPath())
await router.replace(
session.user.passwordChangeRequired ? { name: 'change-password' } : getRedirectPath(),
)
} catch (error: unknown) {
errorMessage.value = getAuthErrorMessage(error)
@@ -116,6 +119,10 @@ onMounted(() => {
<p class="login-subtitle">安全留痕 · 高效签署 · 医患无忧</p>
<p v-if="passwordChanged" class="login-success" role="status">
密码修改成功,请使用新密码重新登录
</p>
<div class="login-field">
<label for="login-username">账号</label>
<input
@@ -301,6 +308,16 @@ onMounted(() => {
font-size: 12px;
}
.login-success {
margin: 0 0 12px;
padding: 8px 10px;
color: #16794d;
font-size: 12px;
text-align: center;
background: #edf9f3;
border-radius: 7px;
}
.login-submit {
width: 100%;
margin-top: 6px;