dev: hotfix, disable SSO temporarily
This commit is contained in:
@@ -3,7 +3,7 @@ import type { z } from 'zod'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { Loader2 } from 'lucide-vue-next'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { useKeycloak } from "~/composables/useKeycloack"
|
||||
// import { useKeycloak } from "~/composables/useKeycloack"
|
||||
|
||||
interface Props {
|
||||
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)
|
||||
|
||||
onMounted(async () => {
|
||||
await initKeycloak('check-sso')
|
||||
profile.value = getProfile()
|
||||
// await initKeycloak('check-sso')
|
||||
// profile.value = getProfile()
|
||||
console.log(profile)
|
||||
})
|
||||
|
||||
const onSSO = (async () => {
|
||||
try {
|
||||
const redirect = window.location.origin + '/auth/sso'
|
||||
await loginSSO({ redirectUri: redirect })
|
||||
// await loginSSO({ redirectUri: redirect })
|
||||
} catch (error) {
|
||||
console.error('Call SSO failed:', error)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useSidebar } from '~/components/pub/ui/sidebar'
|
||||
import { useKeycloak } from "~/composables/useKeycloack"
|
||||
// import { useKeycloak } from "~/composables/useKeycloack"
|
||||
|
||||
// defineProps<{
|
||||
// user: {
|
||||
@@ -12,15 +12,15 @@ import { useKeycloak } from "~/composables/useKeycloack"
|
||||
|
||||
const { isMobile } = useSidebar()
|
||||
const { user, logout, setActiveRole, getActiveRole } = useUserStore()
|
||||
const { initKeycloak, logoutSSO } = useKeycloak()
|
||||
// const { initKeycloak, logoutSSO } = useKeycloak()
|
||||
// const userStore = useUserStore().user
|
||||
|
||||
function handleLogout() {
|
||||
initKeycloak('check-sso')
|
||||
// initKeycloak('check-sso')
|
||||
|
||||
navigateTo('/auth/login')
|
||||
logout()
|
||||
logoutSSO(window.location.origin + '/auth/login')
|
||||
// logoutSSO(window.location.origin + '/auth/login')
|
||||
}
|
||||
|
||||
const showModalTheme = ref(false)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useKeycloak } from "~/composables/useKeycloack"
|
||||
// import { useKeycloak } from "~/composables/useKeycloack"
|
||||
|
||||
export default defineNuxtRouteMiddleware(async (to) => {
|
||||
if (to.meta.public) return
|
||||
@@ -6,17 +6,17 @@ export default defineNuxtRouteMiddleware(async (to) => {
|
||||
|
||||
const { $pinia } = useNuxtApp()
|
||||
|
||||
const { initKeycloak, isAuthenticated, getResponse} = useKeycloak(); // global composable
|
||||
await initKeycloak("check-sso");
|
||||
// const { initKeycloak, isAuthenticated, getResponse} = useKeycloak(); // global composable
|
||||
// await initKeycloak("check-sso");
|
||||
|
||||
if (import.meta.client) {
|
||||
const userStore = useUserStore($pinia)
|
||||
if (!userStore.isAuthenticated && !isAuthenticated.value) {
|
||||
return navigateTo('/auth/login')
|
||||
} else {
|
||||
if (isAuthenticated.value) {
|
||||
await getResponse()
|
||||
}
|
||||
// if (isAuthenticated.value) {
|
||||
// await getResponse()
|
||||
// }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user