mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-15 23:01:11 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -22,6 +22,9 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
src() {
|
||||
if (process.env.VUE_APP_BASE_API === '/') {
|
||||
return this.value
|
||||
}
|
||||
return `${process.env.VUE_APP_BASE_API}${this.value}`
|
||||
}
|
||||
},
|
||||
|
@@ -69,6 +69,7 @@
|
||||
"Role": "角色",
|
||||
"SerialNumber": "序列号",
|
||||
"SetMFA": "设置多因子认证",
|
||||
"UpdateMFA": "更改多因子认证",
|
||||
"Source": "来源",
|
||||
"SystemUserDetail": "系统用户详情",
|
||||
"SystemUsers": "系统用户",
|
||||
|
@@ -53,6 +53,9 @@ export default {
|
||||
methods: {
|
||||
handleClick(val) {
|
||||
switch (val) {
|
||||
case 'profile':
|
||||
this.$router.push({ name: 'userProfile' })
|
||||
break
|
||||
case 'AdminPage':
|
||||
setPermission('Admin')
|
||||
window.location.href = `/`
|
||||
|
@@ -54,7 +54,31 @@ export const constantRoutes = [
|
||||
}
|
||||
]
|
||||
|
||||
/**
|
||||
* admin and user routes
|
||||
* the routes that need to be dynamically loaded based on admin or user roles
|
||||
*/
|
||||
export const commonRoutes = {
|
||||
userProfile: {
|
||||
path: '/users/profile',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'userProfile',
|
||||
component: () => import('@/userviews/users/index'),
|
||||
meta: { title: i18n.t('route.UserProfile'), icon: 'user', activeMenu: '/users/profile' }
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* admin
|
||||
* the routes that need to be dynamically loaded based on admin roles
|
||||
*/
|
||||
export const adminRoutes = [
|
||||
Object.assign({}, commonRoutes.userProfile, { hidden: true }),
|
||||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
@@ -187,18 +211,7 @@ export const userRoutes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/users',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: '/users/profile',
|
||||
name: 'profile',
|
||||
component: () => import('@/userviews/users/index'),
|
||||
meta: { title: i18n.t('route.UserProfile'), icon: 'user' }
|
||||
}
|
||||
]
|
||||
},
|
||||
commonRoutes.userProfile,
|
||||
{
|
||||
path: '/command-executions',
|
||||
component: Layout,
|
||||
|
@@ -14,7 +14,7 @@ import DetailCard from '@/components/DetailCard'
|
||||
import QuickActions from '@/components/QuickActions'
|
||||
import { toSafeLocalDateStr } from '@/utils/common'
|
||||
export default {
|
||||
name: 'Detail',
|
||||
name: 'UserProfile',
|
||||
components: {
|
||||
DetailCard,
|
||||
QuickActions
|
||||
@@ -38,6 +38,16 @@ export default {
|
||||
click: function() {}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('assets.UpdateMFA'),
|
||||
attrs: {
|
||||
type: 'primary',
|
||||
label: this.$t('common.Reset')
|
||||
},
|
||||
callbacks: {
|
||||
click: function() {}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('assets.UpdatePassword'),
|
||||
attrs: {
|
@@ -1,37 +1,36 @@
|
||||
<template>
|
||||
<GenericDetailPage :object.sync="TaskDetail" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
|
||||
<GenericDetailPage :object.sync="user" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
|
||||
<keep-alive>
|
||||
<component :is="config.activeMenu" :object="TaskDetail" />
|
||||
<component :is="config.activeMenu" :object="user" />
|
||||
</keep-alive>
|
||||
</GenericDetailPage>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { GenericDetailPage } from '@/layout/components'
|
||||
import Detail from './Detail.vue'
|
||||
export default {
|
||||
name: 'AssetListDetail',
|
||||
components: {
|
||||
GenericDetailPage,
|
||||
Detail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
TaskDetail: {},
|
||||
config: {
|
||||
title: this.$t('assets.SystemUserDetail'),
|
||||
activeMenu: 'Detail',
|
||||
submenu: [
|
||||
{
|
||||
title: this.$t('assets.detail'),
|
||||
name: 'Detail'
|
||||
}
|
||||
],
|
||||
hasRightSide: false
|
||||
}
|
||||
import { GenericDetailPage } from '@/layout/components'
|
||||
import UserProfile from './UserProfile.vue'
|
||||
export default {
|
||||
name: 'AssetListDetail',
|
||||
components: {
|
||||
GenericDetailPage,
|
||||
UserProfile
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
user: {},
|
||||
config: {
|
||||
title: this.$t('common.nav.Profile'),
|
||||
submenu: [
|
||||
{
|
||||
title: this.$t('common.BasicInfo'),
|
||||
name: 'UserProfile'
|
||||
}
|
||||
],
|
||||
hasRightSide: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@@ -17,14 +17,16 @@ export default {
|
||||
fields: [
|
||||
[this.$t('xpack.Basic'), ['name']],
|
||||
[this.$t('xpack.Asset'), ['username', 'assets', 'nodes']],
|
||||
[this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), ['password_strategy', 'password', 'password_rules_length']],
|
||||
[this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), ['password_strategy', 'password', 'password_rules']],
|
||||
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
|
||||
[this.$t('xpack.Other'), ['comment']]
|
||||
],
|
||||
initial: {
|
||||
password_strategy: 'custom',
|
||||
password_rules_length: 20,
|
||||
is_periodic: true,
|
||||
password_rules: {
|
||||
length: 20
|
||||
},
|
||||
interval: 24
|
||||
},
|
||||
fieldsMeta: {
|
||||
@@ -42,14 +44,14 @@ export default {
|
||||
password: {
|
||||
hidden: (formValue) => {
|
||||
return formValue.password_strategy !== 'custom'
|
||||
}
|
||||
},
|
||||
rules: [
|
||||
{ required: this.$route.meta.action === 'create', message: this.$t('common.fieldRequiredError'), trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
password_rules_length: {
|
||||
type: 'input',
|
||||
label: this.$t('xpack.ChangeAuthPlan.PasswordLength'),
|
||||
hidden: (formValue) => {
|
||||
return ['random_one', 'random_all'].indexOf(formValue.password_strategy) === -1
|
||||
}
|
||||
password_rules: {
|
||||
type: 'group',
|
||||
items: this.generatePasswordRulesItemsFields()
|
||||
},
|
||||
nodes: {
|
||||
label: this.$t('xpack.Node'),
|
||||
@@ -92,22 +94,23 @@ export default {
|
||||
},
|
||||
helpText: '(单位: 时)'
|
||||
}
|
||||
},
|
||||
cleanFormValue(values) {
|
||||
if (['random_one', 'random_all'].indexOf(values.password_strategy) !== -1) {
|
||||
const password_rules = {}
|
||||
const password_rules_prefix = 'password_rules_'
|
||||
for (const key of Object.keys(values)) {
|
||||
if (key.startsWith(password_rules_prefix)) {
|
||||
password_rules[key.slice(password_rules_prefix.length)] = values[key]
|
||||
delete values[key]
|
||||
}
|
||||
}
|
||||
values['password_rules'] = password_rules
|
||||
}
|
||||
return values
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
generatePasswordRulesItemsFields() {
|
||||
const itemsFields = []
|
||||
const items = [
|
||||
{ id: 'length', prop: 'length', label: this.$t('xpack.ChangeAuthPlan.PasswordLength') }
|
||||
]
|
||||
items.forEach((item, index, array) => {
|
||||
itemsFields.push({
|
||||
id: item.id, prop: item.prop, el: {}, attrs: {}, type: 'input', label: item.label, required: true,
|
||||
hidden: (formValue) => { return ['random_one', 'random_all'].indexOf(formValue.password_strategy) === -1 }
|
||||
})
|
||||
})
|
||||
return itemsFields
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user