mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-24 20:47:17 +00:00
fix: user login always change to system org
This commit is contained in:
@@ -71,7 +71,7 @@ export default {
|
||||
},
|
||||
async logout() {
|
||||
const currentOrg = this.$store.getters.currentOrg
|
||||
if (currentOrg.autoEnter) {
|
||||
if (currentOrg.autoEnter || currentOrg.is_system) {
|
||||
await this.$store.dispatch('users/setCurrentOrg', this.$store.getters.preOrg)
|
||||
}
|
||||
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
|
||||
|
@@ -71,10 +71,11 @@ const mutations = {
|
||||
state.consoleOrgs = state.consoleOrgs.filter(i => i.id !== org.id)
|
||||
},
|
||||
SET_CURRENT_ORG(state, org) {
|
||||
// 系统组织和全局组织不设置成 Pre org
|
||||
if (!state.currentOrg?.autoEnter) {
|
||||
state.preOrg = state.currentOrg
|
||||
setPreOrgLocal(state.username, state.currentOrg)
|
||||
// 系统组织不设置成 Pre org
|
||||
const currentOrg = state.currentOrg
|
||||
if (!currentOrg?.autoEnter && !currentOrg.is_system) {
|
||||
state.preOrg = currentOrg
|
||||
setPreOrgLocal(state.username, currentOrg)
|
||||
}
|
||||
state.currentOrg = org
|
||||
saveCurrentOrgLocal(state.username, org)
|
||||
@@ -144,6 +145,7 @@ const actions = {
|
||||
const systemOrg = {
|
||||
id: orgUtil.SYSTEM_ORG_ID,
|
||||
name: 'SystemSetting',
|
||||
is_system: true,
|
||||
autoEnter: new Date().getTime()
|
||||
}
|
||||
commit('SET_CURRENT_ORG', systemOrg)
|
||||
|
@@ -17,7 +17,7 @@ function getPropOrg() {
|
||||
if (defaultOrg) {
|
||||
return defaultOrg
|
||||
}
|
||||
return orgs.filter(item => !item['is_root'] && item.id !== SYSTEM_ORG_ID)[0]
|
||||
return orgs.filter(item => !item['is_root'] && !item['is_system'])[0]
|
||||
}
|
||||
|
||||
async function change2PropOrg() {
|
||||
|
@@ -8,7 +8,10 @@ import orgs from '@/api/orgs'
|
||||
import { getPropView, isViewHasOrgs } from '@/utils/jms'
|
||||
|
||||
const whiteList = ['/login', process.env.VUE_APP_LOGIN_PATH] // no redirect whitelist
|
||||
const autoEnterOrgs = ['00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000000']
|
||||
const autoEnterOrgs = [
|
||||
'00000000-0000-0000-0000-000000000001',
|
||||
'00000000-0000-0000-0000-000000000000'
|
||||
]
|
||||
|
||||
function reject(msg) {
|
||||
return new Promise((resolve, reject) => reject(msg))
|
||||
|
Reference in New Issue
Block a user