mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-01 19:58:29 +08:00
[BUG-12306][UI]Fix the password item always is disabled (#12437)
* Fix the password item always is disabled
This commit is contained in:
parent
70aef3ec21
commit
651588c98d
@ -39,6 +39,7 @@ export function useDropDown() {
|
||||
const useLogout = () => {
|
||||
logout().then(() => {
|
||||
userStore.setSessionId('')
|
||||
userStore.setSecurityConfigType('')
|
||||
userStore.setUserInfo({})
|
||||
cookies.remove('sessionId')
|
||||
|
||||
|
@ -349,9 +349,7 @@ export function useDataList() {
|
||||
label: t('user_dropdown.password'),
|
||||
key: 'password',
|
||||
icon: renderIcon(KeyOutlined),
|
||||
disabled:
|
||||
(userStore.getUserInfo as UserInfoRes).securityConfigType !==
|
||||
'PASSWORD'
|
||||
disabled: userStore.getSecurityConfigType !== 'PASSWORD'
|
||||
},
|
||||
{
|
||||
label: t('user_dropdown.logout'),
|
||||
|
@ -20,8 +20,9 @@ interface LoginReq {
|
||||
userPassword: string
|
||||
}
|
||||
|
||||
interface SessionIdRes {
|
||||
interface LoginRes {
|
||||
securityConfigType: string
|
||||
sessionId: string
|
||||
}
|
||||
|
||||
export { LoginReq, SessionIdRes }
|
||||
export { LoginReq, LoginRes }
|
||||
|
@ -100,7 +100,6 @@ interface UserInfoRes extends UserReq, IdReq {
|
||||
alertGroup?: any
|
||||
createTime: string
|
||||
updateTime: string
|
||||
securityConfigType: 'PASSWORD' | 'LDAP'
|
||||
}
|
||||
|
||||
interface UserListRes {
|
||||
|
@ -61,6 +61,7 @@ const service = axios.create(baseRequestConfig)
|
||||
const err = (err: AxiosError): Promise<AxiosError> => {
|
||||
if (err.response?.status === 401 || err.response?.status === 504) {
|
||||
userStore.setSessionId('')
|
||||
userStore.setSecurityConfigType('')
|
||||
userStore.setUserInfo({})
|
||||
router.push({ path: '/login' })
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import type { UserInfoRes } from '@/service/modules/users/types'
|
||||
|
||||
interface UserState {
|
||||
sessionId: string
|
||||
securityConfigType: string
|
||||
userInfo: UserInfoRes | {}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ export const useUserStore = defineStore({
|
||||
id: 'user',
|
||||
state: (): UserState => ({
|
||||
sessionId: '',
|
||||
securityConfigType: '',
|
||||
userInfo: {}
|
||||
}),
|
||||
persist: true,
|
||||
@ -30,6 +31,9 @@ export const useUserStore = defineStore({
|
||||
getSessionId(): string {
|
||||
return this.sessionId
|
||||
},
|
||||
getSecurityConfigType(): string {
|
||||
return this.securityConfigType
|
||||
},
|
||||
getUserInfo(): UserInfoRes | {} {
|
||||
return this.userInfo
|
||||
}
|
||||
@ -38,6 +42,9 @@ export const useUserStore = defineStore({
|
||||
setSessionId(sessionId: string): void {
|
||||
this.sessionId = sessionId
|
||||
},
|
||||
setSecurityConfigType(securityConfigType: string): void {
|
||||
this.securityConfigType = securityConfigType
|
||||
},
|
||||
setUserInfo(userInfo: UserInfoRes | {}): void {
|
||||
this.userInfo = userInfo
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import { login } from '@/service/modules/login'
|
||||
import { getUserInfo } from '@/service/modules/users'
|
||||
import { useUserStore } from '@/store/user/user'
|
||||
import type { Router } from 'vue-router'
|
||||
import type { SessionIdRes } from '@/service/modules/login/types'
|
||||
import type { LoginRes } from '@/service/modules/login/types'
|
||||
import type { UserInfoRes } from '@/service/modules/users/types'
|
||||
import { useRouteStore } from '@/store/route/route'
|
||||
import { useTimezoneStore } from '@/store/timezone/timezone'
|
||||
@ -34,8 +34,9 @@ export function useLogin(state: any) {
|
||||
const handleLogin = () => {
|
||||
state.loginFormRef.validate(async (valid: any) => {
|
||||
if (!valid) {
|
||||
const loginRes: SessionIdRes = await login({ ...state.loginForm })
|
||||
const loginRes: LoginRes = await login({ ...state.loginForm })
|
||||
await userStore.setSessionId(loginRes.sessionId)
|
||||
await userStore.setSecurityConfigType(loginRes.securityConfigType)
|
||||
|
||||
const userInfoRes: UserInfoRes = await getUserInfo()
|
||||
await userStore.setUserInfo(userInfoRes)
|
||||
|
@ -40,6 +40,7 @@ export function useUpdate(state: any) {
|
||||
})
|
||||
|
||||
await userStore.setSessionId('')
|
||||
await userStore.setSecurityConfigType('')
|
||||
await userStore.setUserInfo({})
|
||||
await router.push({ path: 'login' })
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user