fix: 登录页401时,不再触发window.location.href='/'

This commit is contained in:
sophie committed 2026-05-14 09:19:38 +08:00
1 parent 016f992346
commit 2e9a70933d
2 files changed
+12 -4

No files matched your search

+7 -3
View File
@@ -409,7 +409,10 @@ const persistLoginUser = (user: any) => {
const DEFAULT_POST_LOGIN_AGENT_ID = 16;
const handleLogin = async () => {
const handleLogin = async (event?: Event) => {
event?.preventDefault();
event?.stopPropagation();
if (!loginUsername.value.trim()) {
showMessageDialog('warning', t('login.usernameRequired'));
return;
@@ -1298,11 +1301,12 @@ onMounted(async () => {
<label for="rememberMe" class="text-sm text-slate-600 cursor-pointer select-none">{{ $t('login.rememberMe') }}</label>
</div>
<button @click="handleLogin" class="btn-primary w-full py-3 text-base shadow-brand-500/40 hover:shadow-brand-500/50 transform hover:-translate-y-0.5 transition-all mt-4">
<button type="button" @click="handleLogin" class="btn-primary w-full py-3 text-base shadow-brand-500/40 hover:shadow-brand-500/50 transform hover:-translate-y-0.5 transition-all mt-4">
{{ $t('login.submit') }}
</button>
<button
type="button"
v-if="config.auth?.wecom?.enabled && (!config.auth?.wecom?.loginViaCasdoor || config.auth?.casdoor?.enabled)"
@click="handleWecomLogin"
:disabled="isWecomLoggingIn"
@@ -1312,7 +1316,7 @@ onMounted(async () => {
</button>
<div class="flex justify-between items-center pt-4 mt-2 border-t border-slate-100/50">
<button @click="showForgotPasswordModal = true" class="text-sm text-slate-500 hover:text-brand-600 transition-colors">
<button type="button" @click="showForgotPasswordModal = true" class="text-sm text-slate-500 hover:text-brand-600 transition-colors">
{{ $t('login.forgotPassword') }}
</button>
<!-- 点击注册 -->