feat: implement auto-setup for Lite edition, enhancing user experience by automating user and tenant creation on first launch

This commit is contained in:
wizardchen
2026-04-11 12:47:17 +08:00
committed by lyingbug
parent 52bdfd388a
commit 92bf52721c
8 changed files with 221 additions and 56 deletions
+13 -3
View File
@@ -377,7 +377,7 @@ import { Autoplay, EffectFade, Pagination } from 'swiper/modules'
import 'swiper/css'
import 'swiper/css/effect-fade'
import 'swiper/css/pagination'
import { login, register, getOIDCAuthorizationURL, getOIDCConfig } from '@/api/auth'
import { login, register, getOIDCAuthorizationURL, getOIDCConfig, autoSetup } from '@/api/auth'
import { useAuthStore } from '@/stores/auth'
import { useI18n } from 'vue-i18n'
@@ -668,13 +668,23 @@ const handleRegister = async () => {
}
}
// Check if already logged in
onMounted(() => {
// Check if already logged in; for lite edition, attempt transparent auto-setup
onMounted(async () => {
if (authStore.isLoggedIn) {
router.replace('/platform/knowledge-bases')
return
}
try {
const response = await autoSetup()
if (response.success) {
await persistLoginResponse(response)
return
}
} catch {
// auto-setup not available (standard edition) — show normal login form
}
loadOIDCConfig()
})
</script>