diff --git a/frontend/src/components/layout/Person.vue b/frontend/src/components/layout/Person.vue
index a0ada36c..a683ab1d 100644
--- a/frontend/src/components/layout/Person.vue
+++ b/frontend/src/components/layout/Person.vue
@@ -19,7 +19,9 @@ import { useRouter } from 'vue-router'
import { useUserStore } from '@/stores/user'
import { userApi } from '@/api/auth'
import { toLoginPage } from '@/utils/utils'
+import { useCache } from '@/utils/useCache'
+const { wsCache } = useCache()
const router = useRouter()
const appearanceStore = useAppearanceStoreWithOut()
const userStore = useUserStore()
@@ -36,6 +38,10 @@ const currentLanguage = computed(() => userStore.getLanguage)
const isAdmin = computed(() => userStore.isAdmin)
const isLocalUser = computed(() => !userStore.getOrigin)
+const isClient = computed(() => {
+ return !!wsCache.get('sqlbot-platform-client')
+})
+
const platFlag = computed(() => {
const platformInfo = userStore.getPlatformInfo
return platformInfo?.origin || 0
@@ -184,7 +190,7 @@ const logout = async () => {
+
diff --git a/frontend/src/stores/user.ts b/frontend/src/stores/user.ts
index cc8c13b5..5f1fb433 100644
--- a/frontend/src/stores/user.ts
+++ b/frontend/src/stores/user.ts
@@ -4,7 +4,7 @@ import { AuthApi } from '@/api/login'
import { useCache } from '@/utils/useCache'
import { i18n } from '@/i18n'
import { store } from './index'
-import { getCurrentRouter, getQueryString } from '@/utils/utils'
+import { getCurrentRouter, getQueryString, isPlatform } from '@/utils/utils'
const { wsCache } = useCache()
@@ -98,7 +98,10 @@ export const UserStore = defineStore('user', {
window.open(res, '_self')
return res
}
- if (getQueryString('code') && getQueryString('state')?.includes('oauth2_state')) {
+ if (
+ (getQueryString('code') && getQueryString('state')?.includes('oauth2_state')) ||
+ isPlatform()
+ ) {
const currentPath = getCurrentRouter()
let logout_url = location.origin + location.pathname + '#/login'
if (currentPath) {
diff --git a/frontend/src/utils/utils.ts b/frontend/src/utils/utils.ts
index 267e587e..65aa4fed 100644
--- a/frontend/src/utils/utils.ts
+++ b/frontend/src/utils/utils.ts
@@ -245,11 +245,21 @@ export const isLarkPlatform = () => {
return !!getQueryString('state') && !!getQueryString('code')
}
+export const isPlatform = () => {
+ const state = getQueryString('state')
+ const platformArray = ['wecom', 'dingtalk', 'lark']
+ return (
+ !!state &&
+ !!getQueryString('code') &&
+ platformArray.some((item: string) => state.includes(item))
+ )
+}
+
export const isPlatformClient = () => {
return !!getQueryString('client') || getQueryString('state')?.includes('client')
}
-export const checkPlatform = () => {
+/* export const checkPlatform = () => {
const flagArray = ['/casbi', 'oidcbi']
const pathname = window.location.pathname
if (
@@ -265,7 +275,7 @@ export const cleanPlatformFlag = () => {
const platformKey = 'out_auth_platform'
wsCache.delete(platformKey)
return false
-}
+} */
export function isTablet() {
const userAgent = navigator.userAgent
const tabletRegex = /iPad|Silk|Galaxy Tab|PlayBook|BlackBerry|(tablet|ipad|playbook)/i
diff --git a/frontend/src/views/login/xpack/Handler.vue b/frontend/src/views/login/xpack/Handler.vue
index 8f7ab3d6..1134d3c7 100644
--- a/frontend/src/views/login/xpack/Handler.vue
+++ b/frontend/src/views/login/xpack/Handler.vue
@@ -325,7 +325,7 @@ const casLogin = () => {
.then((res: any) => {
const token = res.access_token
if (token && isPlatformClient()) {
- wsCache.set('de-platform-client', true)
+ wsCache.set('sqlbot-platform-client', true)
}
userStore.setToken(token)
userStore.setExp(res.exp)
@@ -358,7 +358,7 @@ const oauth2Login = () => {
const token = res.access_token
const platform_info = res.platform_info
if (token && isPlatformClient()) {
- wsCache.set('de-platform-client', true)
+ wsCache.set('sqlbot-platform-client', true)
}
userStore.setToken(token)
userStore.setExp(res.exp)
@@ -391,7 +391,7 @@ const oidcLogin = () => {
const token = res.access_token
const platform_info = res.platform_info
if (token && isPlatformClient()) {
- wsCache.set('de-platform-client', true)
+ wsCache.set('sqlbot-platform-client', true)
}
userStore.setToken(token)
userStore.setExp(res.exp)
@@ -424,7 +424,7 @@ const wecomLogin = () => {
const token = res.access_token
// const platform_info = res.platform_info
if (token && isPlatformClient()) {
- wsCache.set('de-platform-client', true)
+ wsCache.set('sqlbot-platform-client', true)
}
userStore.setToken(token)
userStore.setExp(res.exp)
@@ -457,7 +457,7 @@ const dingtalkLogin = () => {
const token = res.access_token
// const platform_info = res.platform_info
if (token && isPlatformClient()) {
- wsCache.set('de-platform-client', true)
+ wsCache.set('sqlbot-platform-client', true)
}
userStore.setToken(token)
userStore.setExp(res.exp)
@@ -495,7 +495,7 @@ const dingtalkLogin = () => {
}
const token = res.token
if (token && isPlatformClient()) {
- wsCache.set('de-platform-client', true)
+ wsCache.set('sqlbot-platform-client', true)
}
userStore.setToken(token)
userStore.setExp(res.exp)
@@ -647,7 +647,7 @@ onMounted(() => {
updateLoading(false, 100)
return
}
- wsCache.delete('de-platform-client')
+ wsCache.delete('sqlbot-platform-client')
init(async () => {
const state = callBackType()
if (state?.includes('cas') && getQueryString('ticket')) {