feat: 支持自定义短信认证

This commit is contained in:
jiangweidong
2023-05-24 17:33:44 +08:00
committed by Jiangjie.Bai
parent 7a8df3fb7b
commit 62eced61d2
5 changed files with 82 additions and 1 deletions

View File

@@ -1455,6 +1455,7 @@
}
},
"setting": {
"Custom": "Custom",
"CleanHelpText": " Regular cleanup tasks will be executed at 2 o'clock in the morning every day, and the cleaned data cannot be recovered",
"Applets": "Applets",
"EndpointListHelpMessage": "The service endpoint is the address (port) for the user to access the service. When the user connects to the asset, the service endpoint will be selected according to the endpoint rules and asset tags, and the connection will be established as the access entry to realize the distributed connection of assets.",

View File

@@ -1450,6 +1450,7 @@
}
},
"setting": {
"Custom": "カスタムです",
"CleanHelpText": " 定期清理タスクは毎日午前2時に実行され、クリーンアップ後のデータは復元できません",
"OAuth2LogoTip": "ヒント: 認証サービス プロバイダー (推奨画像サイズ: 64px*64px)",
"EndpointListHelpMessage": "サービスエンドポイントは、ユーザーがサービスにアクセスするためのアドレス(ポート)です。ユーザーがアセットに接続すると、エンドポイントルールとアセットタグに従ってサービスエンドポイントが選択され、接続がアクセスエントリとして確立されます。資産の分散接続を実現します。",

View File

@@ -1450,6 +1450,7 @@
"PublishStatus": "发布状态"
},
"setting": {
"Custom": "自定义",
"CleanHelpText": "定期清理任务会在 每天凌晨 2 点执行, 清理后的数据将无法恢复",
"OAuth2LogoTip": "提示:认证服务提供商(建议图片大小为: 64px*64px",
"Applets": "远程应用",

View File

@@ -0,0 +1,70 @@
<template>
<BaseSMS ref="baseSms" :title="$tc('setting.Custom')" :config="$data" />
</template>
<script>
import BaseSMS from './Base'
import { JsonEditor } from '@/components/FormFields'
export default {
name: 'SMSCustom',
components: {
BaseSMS
},
data() {
const vm = this
return {
url: `/api/v1/settings/setting/?category=custom`,
hasDetailInMsg: false,
visible: false,
moreButtons: [
{
title: this.$t('common.Test'),
loading: false,
callback: function(value, form, btn) {
btn.loading = true
vm.$axios.post(
`/api/v1/settings/sms/custom/testing/`,
value
).then(res => {
vm.$message.success(res['msg'])
}).catch((error) => {
vm.$log.error('err occur')
vm.$refs.baseSms.testPerformError(error)
}).finally(() => { btn.loading = false })
}
}
],
fields: [
[
this.$t('common.BasicInfo'),
[
'CUSTOM_SMS_URL', 'CUSTOM_SMS_REQUEST_METHOD', 'CUSTOM_SMS_API_PARAMS'
]
],
[
this.$t('common.Other'),
[
'SMS_TEST_PHONE'
]
]
],
fieldsMeta: {
'CUSTOM_SMS_API_PARAMS': {
label: this.$t('common.Params'),
component: JsonEditor
}
},
submitMethod() {
return 'patch'
}
}
},
computed: {},
methods: {}
}
</script>
<style scoped>
</style>

View File

@@ -7,6 +7,7 @@ import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage
import SMSAlibaba from './SMSAlibaba'
import SMSTencent from './SMSTencent'
import SMSHuawei from './SMSHuawei'
import SMSCustom from './SMSCustom'
import CMPP2 from './CMPP2'
export default {
@@ -25,7 +26,7 @@ export default {
],
[
this.$t('setting.SMSProvider'), [
'ALIYUN', 'QCLOUD', 'HUAWEICLOUD', 'CMPP2'
'ALIYUN', 'QCLOUD', 'HUAWEICLOUD', 'CMPP2', 'SMSCustom'
]
]
],
@@ -57,6 +58,13 @@ export default {
hidden: (form) => {
return form['SMS_BACKEND'] !== 'cmpp2'
}
},
SMSCustom: {
label: this.$t('setting.Custom'),
component: SMSCustom,
hidden: (form) => {
return form['SMS_BACKEND'] !== 'custom'
}
}
},
submitMethod() {