feat: 账号备份密钥拆分

This commit is contained in:
feng 2023-08-04 16:38:01 +08:00
parent e4af9ccc1e
commit e5eaa5bcfa
7 changed files with 44 additions and 11 deletions

View File

@ -107,7 +107,8 @@
"Backup": "Backup", "Backup": "Backup",
"ExecutionList": "Execution list", "ExecutionList": "Execution list",
"Reason": "Reason", "Reason": "Reason",
"AccountBackup": "Account backup" "AccountBackup": "Account backup",
"RecipientHelpText": "Currently, only email sending is supported. If both recipients A and B are set, the account key will be split into two parts: front and back"
}, },
"DynamicUsername": "Dynamic username", "DynamicUsername": "Dynamic username",
"AutoCreate": "Auto create", "AutoCreate": "Auto create",

View File

@ -107,7 +107,8 @@
"Backup": "バックアップ", "Backup": "バックアップ",
"ExecutionList": "実行リスト", "ExecutionList": "実行リスト",
"Reason": "理由", "Reason": "理由",
"AccountBackup": "アカウントのバックアップ" "AccountBackup": "アカウントのバックアップ",
"RecipientHelpText": "現在はメール送信のみをサポートしており、受信者A Bが設定されている場合、アカウントの鍵は前後2つに分割されます"
}, },
"DynamicUsername": "動的ユーザー名", "DynamicUsername": "動的ユーザー名",
"AutoCreate": "自動作成", "AutoCreate": "自動作成",

View File

@ -42,7 +42,8 @@
"ExecutionList": "执行列表", "ExecutionList": "执行列表",
"MailRecipient": "邮件收件人", "MailRecipient": "邮件收件人",
"IsSuccess": "是否成功", "IsSuccess": "是否成功",
"Reason": "原因" "Reason": "原因",
"RecipientHelpText": "当前只支持邮件发送, 若收件人 A B 都设置,账号的密钥将被拆分成前后两部分"
}, },
"AccountChangeSecret": { "AccountChangeSecret": {
"ParamsHelpText": "改密参数设置,目前仅对平台种类为主机的资产生效。", "ParamsHelpText": "改密参数设置,目前仅对平台种类为主机的资产生效。",

View File

@ -19,7 +19,7 @@ export default {
fields: [ fields: [
[this.$t('common.Basic'), ['name']], [this.$t('common.Basic'), ['name']],
[this.$t('accounts.AccountBackup.Types'), ['types']], [this.$t('accounts.AccountBackup.Types'), ['types']],
[this.$t('accounts.AccountBackup.Backup'), ['recipients']], [this.$t('accounts.AccountBackup.Backup'), ['recipients_part_one', 'recipients_part_two']],
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']], [this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
[this.$t('common.Other'), ['comment']] [this.$t('common.Other'), ['comment']]
], ],
@ -32,7 +32,8 @@ export default {
is_periodic: fields.is_periodic, is_periodic: fields.is_periodic,
crontab: fields.crontab, crontab: fields.crontab,
interval: fields.interval, interval: fields.interval,
recipients: fields.recipients, recipients_part_one: fields.recipients_part_one,
recipients_part_two: fields.recipients_part_two,
types: { types: {
component: 'el-cascader', component: 'el-cascader',
label: this.$t('accounts.AccountBackup.Types'), label: this.$t('accounts.AccountBackup.Types'),

View File

@ -32,7 +32,7 @@ export default {
label: this.$t('common.DisplayName'), label: this.$t('common.DisplayName'),
formatter: DetailFormatter, formatter: DetailFormatter,
formatterArgs: { formatterArgs: {
getTitle: ({ row }) => row.plan_snapshot.name, getTitle: ({ row }) => row.snapshot.name,
getRoute: ({ row }) => ({ getRoute: ({ row }) => ({
name: 'AccountBackupPlanDetail', name: 'AccountBackupPlanDetail',
params: { id: row.plan } params: { id: row.plan }

View File

@ -65,7 +65,21 @@ export default {
return <span>{this.object.is_periodic ? val : ''}</span> return <span>{this.object.is_periodic ? val : ''}</span>
} }
}, },
'date_created', 'date_updated', 'comment' 'date_created', 'date_updated', 'comment',
{
key: this.$t('accounts.AccountChangeSecret.Addressee') + ' A',
value: this.object.recipients_part_one,
formatter: (item, val) => {
return <span>{val.map(item => item.name).join(', ')}</span>
}
},
{
key: this.$t('accounts.AccountChangeSecret.Addressee') + ' B',
value: this.object.recipients_part_two,
formatter: (item, val) => {
return <span>{val.map(item => item.name).join(', ')}</span>
}
}
] ]
} }
}, },

View File

@ -9,9 +9,23 @@ const validatorInterval = (rule, value, callback) => {
} }
function getAccountBackupFields() { function getAccountBackupFields() {
const recipients = { const recipients_part_one = {
label: i18n.t('accounts.AccountChangeSecret.Addressee'), label: i18n.t('accounts.AccountChangeSecret.Addressee') + ' A',
helpText: i18n.t('accounts.AccountChangeSecret.OnlyMailSend'), helpText: i18n.t('accounts.AccountBackup.RecipientHelpText'),
el: {
value: [],
ajax: {
url: '/api/v1/users/users/?fields_size=mini',
transformOption: (item) => {
return { label: item.name + '(' + item.username + ')', value: item.id }
}
}
}
}
const recipients_part_two = {
label: i18n.t('accounts.AccountChangeSecret.Addressee') + ' B',
helpText: i18n.t('accounts.AccountBackup.RecipientHelpText'),
el: { el: {
value: [], value: [],
ajax: { ajax: {
@ -52,7 +66,8 @@ function getAccountBackupFields() {
is_periodic: is_periodic, is_periodic: is_periodic,
crontab: crontab, crontab: crontab,
interval: interval, interval: interval,
recipients: recipients recipients_part_one: recipients_part_one,
recipients_part_two: recipients_part_two
} }
} }