feat: 密码计划邮件提醒

This commit is contained in:
feng626
2021-12-03 15:57:48 +08:00
committed by Jiangjie.Bai
parent 91162f6013
commit 5eff271cb2
9 changed files with 109 additions and 7 deletions

View File

@@ -1094,6 +1094,7 @@
"UpdateNodeAssetHardwareInfo": "更新节点资产硬件信息"
},
"users": {
"FileEncryptionPassword": "文件加密密码",
"MessageSubscription": "消息订阅",
"AuthSettings": "认证配置",
"UserName": "姓名",
@@ -1233,7 +1234,9 @@
"AssetCount": "资产数量",
"Auditor": "审计员",
"ChangeAuthPlan": {
"ContainAttachment": "含附件",
"AddAsset": "添加资产",
"MailRecipient": "邮件收件人",
"AddNode": "添加节点",
"AddSystemUser": "添加系统用户",
"Asset": "资产",

View File

@@ -1057,6 +1057,7 @@
"UpdateNodeAssetHardwareInfo": "Update node asset hardware information"
},
"users": {
"FileEncryptionPassword": "File encryption password",
"MessageSubscription": "Message Subscription",
"AuthSettings": "Auth settings",
"UserName": "Name",
@@ -1193,7 +1194,9 @@
"AssetCount": "Asset count",
"Auditor": "Auditor",
"ChangeAuthPlan": {
"MailRecipient": "Mail recipient",
"AddAsset": "Add asset",
"ContainAttachment": "Contain attachment",
"AddNode": "Add node",
"AddSystemUser": "Add systemuser",
"Asset": "Asset",

View File

@@ -0,0 +1,67 @@
<template>
<IBox>
<GenericCreateUpdateForm
:fields="fields"
:fields-meta="fieldsMeta"
:initial="object"
:url="url"
:submit-method="submitMethod"
class="password-update"
:update-success-next-route="updateSuccessNextRoute"
/>
</IBox>
</template>
<script>
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm'
import { IBox } from '@/components'
export default {
name: 'SecretKeyUpdate',
components: {
GenericCreateUpdateForm,
IBox
},
props: {
object: {
type: Object,
default: null
}
},
data() {
return {
url: '/api/v1/users/profile/secret-key/',
fields: ['new_secret_key', 'new_secret_key_again'],
fieldsMeta: {
new_secret_key: {
label: this.$t('users.NewPassword'),
el: {
type: 'password'
}
},
new_secret_key_again: {
label: this.$t('users.ConfirmPassword'),
el: {
type: 'password'
}
}
},
updateSuccessNextRoute: {
path: '/'
}
}
},
methods: {
submitMethod() {
return 'put'
}
}
}
</script>
<style lang="scss" scoped>
.password-update >>> .el-input {
width: 600px;
max-width: 600px;
}
</style>

View File

@@ -11,6 +11,7 @@ import { GenericDetailPage } from '@/layout/components'
import ProfileInfo from './ProfileInfo'
import ProfileUpdate from './ProfileUpdate'
import PasswordUpdate from './PasswordUpdate'
import SecretKeyUpdate from './SecretKeyUpdate'
import SSHUpdate from './SSHUpdate'
export default {
@@ -19,6 +20,7 @@ export default {
ProfileInfo,
ProfileUpdate,
PasswordUpdate,
SecretKeyUpdate,
SSHUpdate
},
data() {
@@ -55,6 +57,10 @@ export default {
title: this.$t('users.SSHKeySetting'),
name: 'SSHUpdate',
disabled: !this.$store.state.users.profile.can_public_key_auth
},
{
title: this.$t('users.FileEncryptionPassword'),
name: 'SecretKeyUpdate'
}
]
},

View File

@@ -20,7 +20,7 @@ export default {
[this.$t('assets.Applications'), ['category', 'type', 'apps', 'system_users']],
[this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), ['password_strategy', 'password', 'password_rules']],
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
[this.$t('common.Other'), ['comment']]
[this.$t('common.Other'), ['recipients', 'comment']]
],
initial: {
type: this.$route.query.type,
@@ -81,7 +81,8 @@ export default {
is_periodic: fields.is_periodic,
password_strategy: fields.password_strategy,
crontab: fields.crontab,
interval: fields.interval
interval: fields.interval,
recipients: fields.recipients
},
createSuccessNextRoute: { name: 'ChangeAuthPlanIndex' },
updateSuccessNextRoute: { name: 'ChangeAuthPlanIndex' },

View File

@@ -55,8 +55,12 @@ export default {
{
key: this.$t('xpack.ChangeAuthPlan.DateStart'),
value: toSafeLocalDateStr(this.object.date_start)
},
{
key: this.$t('xpack.ChangeAuthPlan.MailRecipient'),
value: this.object.recipients ? this.object.recipients.map(
i => `${i[0]}` + `${i[1] ? ': ' + this.$t('xpack.ChangeAuthPlan.ContainAttachment') : ''}`).join(', ') : ''
}
]
}
}

View File

@@ -21,7 +21,7 @@ export default {
[this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), ['is_password', 'password_strategy', 'password', 'password_rules']],
[this.$t('xpack.ChangeAuthPlan.SecretKeyStrategy'), ['is_ssh_key', 'ssh_key_strategy', 'private_key']],
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
[this.$t('common.Other'), ['comment']]
[this.$t('common.Other'), ['recipients', 'comment']]
],
initial: {
password_strategy: 'custom',
@@ -47,7 +47,8 @@ export default {
password_strategy: fields.password_strategy,
ssh_key_strategy: fields.ssh_key_strategy,
crontab: fields.crontab,
interval: fields.interval
interval: fields.interval,
recipients: fields.recipients
},
createSuccessNextRoute: { name: 'ChangeAuthPlanIndex' },
updateSuccessNextRoute: { name: 'ChangeAuthPlanIndex' },

View File

@@ -51,8 +51,12 @@ export default {
{
key: this.$t('xpack.ChangeAuthPlan.DateStart'),
value: toSafeLocalDateStr(this.object.date_start)
},
{
key: this.$t('xpack.ChangeAuthPlan.MailRecipient'),
value: this.object.recipients ? this.object.recipients.map(
i => `${i[0]}` + `${i[1] ? ': ' + this.$t('xpack.ChangeAuthPlan.ContainAttachment') : ''}`).join(', ') : ''
}
]
}
}

View File

@@ -127,6 +127,18 @@ function getFields() {
]
}
const recipients = {
el: {
value: [],
ajax: {
url: '/api/v1/users/users/?fields_size=mini',
transformOption: (item) => {
return { label: item.name + '(' + item.username + ')', value: item.id }
}
}
}
}
const nodes = {
label: i18n.t('xpack.Node'),
el: {
@@ -220,7 +232,8 @@ function getFields() {
is_periodic: is_periodic,
is_ssh_key: is_ssh_key,
crontab: crontab,
interval: interval
interval: interval,
recipients: recipients
}
}