mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf(X-Pack): Hide Password Change for Third-Party Users
This commit is contained in:
committed by
fit2cloud-chenyw
parent
1c104e93c6
commit
a6744dd9d1
@@ -31,6 +31,7 @@ const name = computed(() => userStore.getName)
|
||||
const account = computed(() => userStore.getAccount)
|
||||
const currentLanguage = computed(() => userStore.getLanguage)
|
||||
const isAdmin = computed(() => userStore.isAdmin)
|
||||
const isLocalUser = computed(() => !userStore.getOrigin)
|
||||
const dialogVisible = ref(false)
|
||||
const aboutRef = ref()
|
||||
const languageList = computed(() => [
|
||||
@@ -119,7 +120,7 @@ const logout = async () => {
|
||||
</el-icon>
|
||||
<div class="datasource-name">{{ $t('common.system_manage') }}</div>
|
||||
</div>
|
||||
<div class="popover-item" @click="openPwd">
|
||||
<div v-if="isLocalUser" class="popover-item" @click="openPwd">
|
||||
<el-icon size="16">
|
||||
<icon_key_outlined></icon_key_outlined>
|
||||
</el-icon>
|
||||
|
||||
@@ -18,6 +18,7 @@ interface UserState {
|
||||
exp: number
|
||||
time: number
|
||||
weight: number
|
||||
origin: number
|
||||
platformInfo: any | null
|
||||
[key: string]: string | number | any | null
|
||||
}
|
||||
@@ -34,6 +35,7 @@ export const UserStore = defineStore('user', {
|
||||
exp: 0,
|
||||
time: 0,
|
||||
weight: 0,
|
||||
origin: 0,
|
||||
platformInfo: null,
|
||||
}
|
||||
},
|
||||
@@ -68,6 +70,9 @@ export const UserStore = defineStore('user', {
|
||||
getWeight(): number {
|
||||
return this.weight
|
||||
},
|
||||
getOrigin(): number {
|
||||
return this.origin
|
||||
},
|
||||
isSpaceAdmin(): boolean {
|
||||
return this.uid === '1' || !!this.weight
|
||||
},
|
||||
@@ -106,12 +111,22 @@ export const UserStore = defineStore('user', {
|
||||
const res: any = await AuthApi.info()
|
||||
const res_data = res || {}
|
||||
|
||||
const keys = ['uid', 'account', 'name', 'oid', 'language', 'exp', 'time', 'weight'] as const
|
||||
const keys = [
|
||||
'uid',
|
||||
'account',
|
||||
'name',
|
||||
'oid',
|
||||
'language',
|
||||
'exp',
|
||||
'time',
|
||||
'weight',
|
||||
'origin',
|
||||
] as const
|
||||
|
||||
keys.forEach((key) => {
|
||||
const dkey = key === 'uid' ? 'id' : key
|
||||
const value = res_data[dkey]
|
||||
if (key === 'exp' || key === 'time' || key === 'weight') {
|
||||
if (key === 'exp' || key === 'time' || key === 'weight' || key === 'origin') {
|
||||
this[key] = Number(value)
|
||||
} else {
|
||||
this[key] = String(value)
|
||||
@@ -168,6 +183,10 @@ export const UserStore = defineStore('user', {
|
||||
wsCache.set('user.weight', weight)
|
||||
this.weight = weight
|
||||
},
|
||||
setOrigin(origin: number) {
|
||||
wsCache.set('user.origin', origin)
|
||||
this.origin = origin
|
||||
},
|
||||
setPlatformInfo(info: any | null) {
|
||||
wsCache.set('user.platformInfo', info)
|
||||
this.platformInfo = info
|
||||
@@ -183,6 +202,7 @@ export const UserStore = defineStore('user', {
|
||||
'exp',
|
||||
'time',
|
||||
'weight',
|
||||
'origin',
|
||||
'platformInfo',
|
||||
]
|
||||
keys.forEach((key) => wsCache.delete('user.' + key))
|
||||
|
||||
@@ -59,6 +59,11 @@ const submitForm = () => {
|
||||
userStore.setToken(token)
|
||||
userStore.setExp(res.exp)
|
||||
userStore.setTime(Date.now())
|
||||
userStore.setPlatformInfo({
|
||||
flag: 'ldap',
|
||||
data: null,
|
||||
origin: 3,
|
||||
})
|
||||
router.push('/')
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user