feat(router): implement auto-setup failure handling for Lite edition

- Added logic to track auto-setup failures using localStorage, preventing repeated attempts if the setup fails.
- Updated the router's authentication flow to conditionally attempt auto-setup based on the failure status.
- Enhanced the login component to check for auto-setup failure before attempting the setup process.

This update improves the user experience by ensuring that failed auto-setup attempts do not lead to repeated failures during login.
This commit is contained in:
wizardchen
2026-04-15 15:10:13 +08:00
committed by lyingbug
parent 9ba8582f70
commit b0531900e9
2 changed files with 26 additions and 11 deletions
+13 -8
View File
@@ -675,15 +675,20 @@ onMounted(async () => {
return
}
try {
const response = await autoSetup()
if (response.success) {
authStore.setLiteMode(true)
await persistLoginResponse(response)
return
const AUTO_SETUP_FAILED_KEY = 'weknora_auto_setup_failed'
if (localStorage.getItem(AUTO_SETUP_FAILED_KEY) !== 'true') {
try {
const response = await autoSetup()
if (response.success) {
authStore.setLiteMode(true)
await persistLoginResponse(response)
return
} else {
localStorage.setItem(AUTO_SETUP_FAILED_KEY, 'true')
}
} catch {
localStorage.setItem(AUTO_SETUP_FAILED_KEY, 'true')
}
} catch {
// auto-setup not available (standard edition) — show normal login form
}
loadOIDCConfig()