mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-25 14:34:46 +00:00
perf: 账号备份增加sftp方式
This commit is contained in:
@@ -109,7 +109,8 @@
|
||||
"ExecutionList": "Execution list",
|
||||
"Reason": "Reason",
|
||||
"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"
|
||||
"RecipientHelpText": "If both recipients A and B are set, the account key will be split into two parts: front and back",
|
||||
"RecipientServer":"Receiving server"
|
||||
},
|
||||
"DynamicUsername": "Dynamic username",
|
||||
"AutoCreate": "Auto create",
|
||||
|
||||
@@ -109,7 +109,8 @@
|
||||
"ExecutionList": "実行リスト",
|
||||
"Reason": "理由",
|
||||
"AccountBackup": "アカウントのバックアップ",
|
||||
"RecipientHelpText": "現在はメール送信のみをサポートしており、受信者A Bが設定されている場合、アカウントの鍵は前後2つに分割されます"
|
||||
"RecipientHelpText": "受信者A Bが設定されている場合、アカウントの鍵は前後2つに分割されます",
|
||||
"RecipientServer":"受信サーバー"
|
||||
},
|
||||
"DynamicUsername": "動的ユーザー名",
|
||||
"AutoCreate": "自動作成",
|
||||
|
||||
@@ -47,7 +47,8 @@
|
||||
"MailRecipient": "邮件收件人",
|
||||
"IsSuccess": "是否成功",
|
||||
"Reason": "原因",
|
||||
"RecipientHelpText": "当前只支持邮件发送, 若收件人 A B 都设置,账号的密钥将被拆分成前后两部分"
|
||||
"RecipientHelpText": "若收件人 A B 都设置,账号的密钥将被拆分成前后两部分",
|
||||
"RecipientServer":"接收服务器"
|
||||
},
|
||||
"AccountChangeSecret": {
|
||||
"PasswordRule": "密码生成规则",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<script>
|
||||
import { GenericCreateUpdatePage } from '@/layout/components'
|
||||
import getChangeSecretFields from '@/views/accounts/AccountBackup/fields'
|
||||
import { encryptPassword } from '@/utils/crypto'
|
||||
|
||||
export default {
|
||||
name: 'AccountBackupPlanUpdate',
|
||||
@@ -19,7 +20,18 @@ export default {
|
||||
fields: [
|
||||
[this.$t('common.Basic'), ['name']],
|
||||
[this.$t('accounts.AccountBackup.Types'), ['types']],
|
||||
[this.$t('accounts.AccountBackup.Backup'), ['recipients_part_one', 'recipients_part_two']],
|
||||
[this.$t('accounts.AccountBackup.Backup'),
|
||||
[
|
||||
'backup_type',
|
||||
'is_password_divided_by_email',
|
||||
'recipients_part_one',
|
||||
'recipients_part_two',
|
||||
'is_password_divided_by_obj_storage',
|
||||
'obj_recipients_part_one',
|
||||
'obj_recipients_part_two',
|
||||
'zip_encrypt_password'
|
||||
]
|
||||
],
|
||||
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
|
||||
[this.$t('common.Other'), ['comment']]
|
||||
],
|
||||
@@ -32,8 +44,13 @@ export default {
|
||||
is_periodic: fields.is_periodic,
|
||||
crontab: fields.crontab,
|
||||
interval: fields.interval,
|
||||
is_password_divided_by_email: fields.is_password_divided_by_email,
|
||||
zip_encrypt_password: fields.zip_encrypt_password,
|
||||
is_password_divided_by_obj_storage: fields.is_password_divided_by_obj_storage,
|
||||
recipients_part_one: fields.recipients_part_one,
|
||||
recipients_part_two: fields.recipients_part_two,
|
||||
obj_recipients_part_one: fields.obj_recipients_part_one,
|
||||
obj_recipients_part_two: fields.obj_recipients_part_two,
|
||||
types: {
|
||||
component: 'el-cascader',
|
||||
label: this.$t('accounts.AccountBackup.Types'),
|
||||
@@ -57,6 +74,9 @@ export default {
|
||||
createSuccessNextRoute: { name: 'AccountBackupList' },
|
||||
updateSuccessNextRoute: { name: 'AccountBackupList' },
|
||||
cleanFormValue(data) {
|
||||
if (data['zip_encrypt_password'] !== '') {
|
||||
data['zip_encrypt_password'] = encryptPassword(data['zip_encrypt_password'])
|
||||
}
|
||||
if (data['interval'] === '') {
|
||||
delete data['interval']
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ function getAccountBackupFields() {
|
||||
const recipients_part_one = {
|
||||
label: i18n.t('accounts.AccountChangeSecret.Addressee') + ' A',
|
||||
helpText: i18n.t('accounts.AccountBackup.RecipientHelpText'),
|
||||
hidden: (formValue) => {
|
||||
return formValue.backup_type !== 'email'
|
||||
},
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
@@ -26,6 +29,9 @@ function getAccountBackupFields() {
|
||||
const recipients_part_two = {
|
||||
label: i18n.t('accounts.AccountChangeSecret.Addressee') + ' B',
|
||||
helpText: i18n.t('accounts.AccountBackup.RecipientHelpText'),
|
||||
hidden: (formValue) => {
|
||||
return !(formValue.backup_type === 'email' && formValue.is_password_divided_by_email)
|
||||
},
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
@@ -36,6 +42,39 @@ function getAccountBackupFields() {
|
||||
}
|
||||
}
|
||||
}
|
||||
const obj_recipients_part_one = {
|
||||
label: i18n.t('accounts.AccountBackup.RecipientServer') + ' A',
|
||||
helpText: i18n.t('accounts.AccountBackup.RecipientHelpText'),
|
||||
hidden: (formValue) => {
|
||||
return formValue.backup_type !== 'object_storage'
|
||||
},
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '/api/v1/terminal/replay-storages/?type=sftp&fields_size=mini',
|
||||
transformOption: (item) => {
|
||||
return { label: item.name + '(' + item.meta.SFTP_HOST + ':' + item.meta.SFTP_ROOT_PATH + ')', value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const obj_recipients_part_two = {
|
||||
label: i18n.t('accounts.AccountBackup.RecipientServer') + ' B',
|
||||
helpText: i18n.t('accounts.AccountBackup.RecipientHelpText'),
|
||||
hidden: (formValue) => {
|
||||
return !(formValue.backup_type === 'object_storage' && formValue.is_password_divided_by_obj_storage)
|
||||
},
|
||||
el: {
|
||||
value: [],
|
||||
ajax: {
|
||||
url: '/api/v1/terminal/replay-storages/?type=sftp&fields_size=mini',
|
||||
transformOption: (item) => {
|
||||
return { label: item.name + '(' + item.meta.SFTP_HOST + ':' + item.meta.SFTP_ROOT_PATH + ')', value: item.id }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const is_periodic = {
|
||||
type: 'switch'
|
||||
@@ -61,13 +100,32 @@ function getAccountBackupFields() {
|
||||
{ validator: validatorInterval }
|
||||
]
|
||||
}
|
||||
|
||||
const is_password_divided_by_email = {
|
||||
hidden: (formValue) => {
|
||||
return formValue.backup_type !== 'email'
|
||||
}
|
||||
}
|
||||
const is_password_divided_by_obj_storage = {
|
||||
hidden: (formValue) => {
|
||||
return formValue.backup_type !== 'object_storage'
|
||||
}
|
||||
}
|
||||
const zip_encrypt_password = {
|
||||
hidden: (formValue) => {
|
||||
return formValue.backup_type !== 'object_storage'
|
||||
}
|
||||
}
|
||||
return {
|
||||
is_periodic: is_periodic,
|
||||
crontab: crontab,
|
||||
interval: interval,
|
||||
is_password_divided_by_email: is_password_divided_by_email,
|
||||
is_password_divided_by_obj_storage: is_password_divided_by_obj_storage,
|
||||
recipients_part_one: recipients_part_one,
|
||||
recipients_part_two: recipients_part_two
|
||||
recipients_part_two: recipients_part_two,
|
||||
obj_recipients_part_one: obj_recipients_part_one,
|
||||
obj_recipients_part_two: obj_recipients_part_two,
|
||||
zip_encrypt_password: zip_encrypt_password
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ export default {
|
||||
hasMoreActions: false,
|
||||
moreCreates: {
|
||||
callback: (item) => {
|
||||
console.log(item)
|
||||
this.$router.push({ name: 'CreateReplayStorage', query: { type: item.name.toLowerCase() }})
|
||||
},
|
||||
dropdown: storageOptions
|
||||
|
||||
@@ -66,7 +66,7 @@ export default {
|
||||
}
|
||||
},
|
||||
cleanFormValue(values) {
|
||||
const encryptedFields = ['SFTP_PASSWORD', 'STP_PASSPHRASE']
|
||||
const encryptedFields = ['SFTP_PASSWORD', 'STP_PASSPHRASE', 'SECRET_KEY', 'ACCOUNT_KEY']
|
||||
const meta = values.meta
|
||||
for (const item of encryptedFields) {
|
||||
const val = meta[item]
|
||||
|
||||
Reference in New Issue
Block a user