Merge branch 'dev' of https://gitee.com/justop/hxops into dev

This commit is contained in:
runny committed 2026-05-07 15:45:23 +08:00
commit 2736224ed7
6 files changed
+107 -10

No files matched your search

+15 -9
View File
@@ -394,7 +394,12 @@ const handleLogin = async () => {
}
try {
const res = await fetch('/api/user/login', {
const loginMode = String(config.auth?.loginMode || 'casdoor').toLowerCase();
const isCasdoorMode = loginMode === 'casdoor';
const loginApi = isCasdoorMode
? (config.auth?.casdoor?.passwordLoginApi || '/api/user/casdoor/password-login')
: '/api/user/login';
const res = await fetch(loginApi, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
@@ -407,6 +412,15 @@ const handleLogin = async () => {
const err = await res.json();
// Handle specific error messages if needed, or just alert
let msg = err.error || t('login.failed');
if (isCasdoorMode) {
if (err.error_code === 'CASDOOR_USER_NOT_FOUND') {
msg = 'Casdoor 登录成功,但未匹配到本地账号,请联系管理员。';
} else if (err.error_code === 'ACCOUNT_DISABLED') {
msg = t('login.accountDisabled');
} else if (String(err.error || '').includes('invalid_grant')) {
msg = t('login.incorrectPassword');
}
}
if (err.error === 'User not found') msg = t('login.userNotFound');
if (err.error === 'Incorrect password') msg = t('login.incorrectPassword');
if (err.error === 'Account is disabled') msg = t('login.accountDisabled');
@@ -1139,14 +1153,6 @@ onBeforeUnmount(() => {
{{ $t('login.submit') }}
</button>
<button
v-if="config.auth?.casdoor?.enabled"
@click="handleCasdoorLogin"
class="btn-secondary w-full py-3 text-base mt-3"
>
{{ $t('login.casdoorLogin') }}
</button>
<button
v-if="config.auth?.wecom?.enabled"
@click="handleWecomLogin"