feat(auth): support local username login mode

This commit is contained in:
mac
2026-07-16 16:19:25 +08:00
parent d5c7cab8bb
commit cafa8bc840
10 changed files with 304 additions and 19 deletions
+10 -1
View File
@@ -61,7 +61,16 @@ request.interceptors.response.use(
if (status === 401) {
removeToken()
redirectToSSO()
fetch('/auth/api/v1/config', { headers: { Accept: 'application/json' } })
.then((response) => response.json())
.then((data) => {
if (data.sso_enabled === false) {
window.location.assign('/login')
} else {
redirectToSSO()
}
})
.catch(() => redirectToSSO())
ElMessage.error(backendMessage || '未授权,请重新登录')
} else {
const message = backendMessage || httpMessageMap[status] || `请求失败 (${status})`