dev: hotfix, disable SSO temporarily

This commit is contained in:
2025-12-17 15:17:05 +07:00
parent 33b6a8660c
commit 0591c05dff
3 changed files with 15 additions and 15 deletions
+5 -5
View File
@@ -3,7 +3,7 @@ import type { z } from 'zod'
import { toTypedSchema } from '@vee-validate/zod' import { toTypedSchema } from '@vee-validate/zod'
import { Loader2 } from 'lucide-vue-next' import { Loader2 } from 'lucide-vue-next'
import { useForm } from 'vee-validate' import { useForm } from 'vee-validate'
import { useKeycloak } from "~/composables/useKeycloack" // import { useKeycloak } from "~/composables/useKeycloack"
interface Props { interface Props {
schema: z.ZodSchema<any> schema: z.ZodSchema<any>
@@ -36,19 +36,19 @@ const onSubmit = handleSubmit(async (values) => {
} }
}) })
const { initKeycloak, getProfile, loginSSO } = useKeycloak() // const { initKeycloak, getProfile, loginSSO } = useKeycloak()
const profile = ref<any>(null) const profile = ref<any>(null)
onMounted(async () => { onMounted(async () => {
await initKeycloak('check-sso') // await initKeycloak('check-sso')
profile.value = getProfile() // profile.value = getProfile()
console.log(profile) console.log(profile)
}) })
const onSSO = (async () => { const onSSO = (async () => {
try { try {
const redirect = window.location.origin + '/auth/sso' const redirect = window.location.origin + '/auth/sso'
await loginSSO({ redirectUri: redirect }) // await loginSSO({ redirectUri: redirect })
} catch (error) { } catch (error) {
console.error('Call SSO failed:', error) console.error('Call SSO failed:', error)
} }
+4 -4
View File
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useSidebar } from '~/components/pub/ui/sidebar' import { useSidebar } from '~/components/pub/ui/sidebar'
import { useKeycloak } from "~/composables/useKeycloack" // import { useKeycloak } from "~/composables/useKeycloack"
// defineProps<{ // defineProps<{
// user: { // user: {
@@ -12,15 +12,15 @@ import { useKeycloak } from "~/composables/useKeycloack"
const { isMobile } = useSidebar() const { isMobile } = useSidebar()
const { user, logout, setActiveRole, getActiveRole } = useUserStore() const { user, logout, setActiveRole, getActiveRole } = useUserStore()
const { initKeycloak, logoutSSO } = useKeycloak() // const { initKeycloak, logoutSSO } = useKeycloak()
// const userStore = useUserStore().user // const userStore = useUserStore().user
function handleLogout() { function handleLogout() {
initKeycloak('check-sso') // initKeycloak('check-sso')
navigateTo('/auth/login') navigateTo('/auth/login')
logout() logout()
logoutSSO(window.location.origin + '/auth/login') // logoutSSO(window.location.origin + '/auth/login')
} }
const showModalTheme = ref(false) const showModalTheme = ref(false)
+6 -6
View File
@@ -1,4 +1,4 @@
import { useKeycloak } from "~/composables/useKeycloack" // import { useKeycloak } from "~/composables/useKeycloack"
export default defineNuxtRouteMiddleware(async (to) => { export default defineNuxtRouteMiddleware(async (to) => {
if (to.meta.public) return if (to.meta.public) return
@@ -6,17 +6,17 @@ export default defineNuxtRouteMiddleware(async (to) => {
const { $pinia } = useNuxtApp() const { $pinia } = useNuxtApp()
const { initKeycloak, isAuthenticated, getResponse} = useKeycloak(); // global composable // const { initKeycloak, isAuthenticated, getResponse} = useKeycloak(); // global composable
await initKeycloak("check-sso"); // await initKeycloak("check-sso");
if (import.meta.client) { if (import.meta.client) {
const userStore = useUserStore($pinia) const userStore = useUserStore($pinia)
if (!userStore.isAuthenticated && !isAuthenticated.value) { if (!userStore.isAuthenticated && !isAuthenticated.value) {
return navigateTo('/auth/login') return navigateTo('/auth/login')
} else { } else {
if (isAuthenticated.value) { // if (isAuthenticated.value) {
await getResponse() // await getResponse()
} // }
} }
} }
}) })