refactor(xPack): 修改跳转认证源的代码

This commit is contained in:
Captain.B 2021-01-25 14:34:43 +08:00
parent a71f75967d
commit 68f4ca38f9
5 changed files with 15 additions and 28 deletions

@ -1 +1 @@
Subproject commit 9e64da846793401150260fc50262d82932cf5d8a Subproject commit 5abe43dc1f65b529ad59c17bfdc58aea33d23cad

View File

@ -129,6 +129,7 @@ export default {
validate: "Validate", validate: "Validate",
batch_add: "Batch add", batch_add: "Batch add",
check_project_tip: "Create or select the project first", check_project_tip: "Create or select the project first",
auth_redirect_tip: 'Jump to the authentication source page for authentication',
table: { table: {
select_tip: "Item {0} data is selected" select_tip: "Item {0} data is selected"
}, },
@ -831,8 +832,8 @@ export default {
swagger_export_tip: "Export jSON-formatted files via Swagger website", swagger_export_tip: "Export jSON-formatted files via Swagger website",
suffixFormatErr: "The file format does not meet the requirements", suffixFormatErr: "The file format does not meet the requirements",
swagger_url_import: "Import using URL", swagger_url_import: "Import using URL",
timing_synchronization:"Timing synchronization", timing_synchronization: "Timing synchronization",
next_synchronization_time:"Next synchronization time", next_synchronization_time: "Next synchronization time",
}, },
home_page: { home_page: {
@ -1493,6 +1494,6 @@ export default {
format: "Output format", format: "Output format",
}, },
auth_source: { auth_source: {
delete_prompt:'This operation will delete the authentication source, do you want to continue? ' delete_prompt: 'This operation will delete the authentication source, do you want to continue? '
} }
}; };

View File

@ -129,6 +129,7 @@ export default {
validate: "校验", validate: "校验",
batch_add: "批量添加", batch_add: "批量添加",
check_project_tip: "请先创建或选择项目", check_project_tip: "请先创建或选择项目",
auth_redirect_tip: '即将跳转到认证源页面进行认证',
table: { table: {
select_tip: "已选中 {0} 条数据" select_tip: "已选中 {0} 条数据"
}, },
@ -833,8 +834,8 @@ export default {
swagger_export_tip: "通过 Swagger 页面导出", swagger_export_tip: "通过 Swagger 页面导出",
suffixFormatErr: "文件格式不符合要求", suffixFormatErr: "文件格式不符合要求",
swagger_url_import: "使用URL导入", swagger_url_import: "使用URL导入",
timing_synchronization:"定时同步", timing_synchronization: "定时同步",
next_synchronization_time:"下次同步时间" next_synchronization_time: "下次同步时间"
}, },

View File

@ -129,6 +129,7 @@ export default {
validate: "校驗", validate: "校驗",
batch_add: "批量添加", batch_add: "批量添加",
check_project_tip: "請先創建或選擇項目", check_project_tip: "請先創建或選擇項目",
auth_redirect_tip: '即將跳轉到認證源頁面進行認證',
table: { table: {
select_tip: "已选中 {0} 条数据" select_tip: "已选中 {0} 条数据"
}, },
@ -256,8 +257,8 @@ export default {
nail_robot: '釘釘機器人', nail_robot: '釘釘機器人',
enterprise_wechat_robot: '企業微信機器人', enterprise_wechat_robot: '企業微信機器人',
notes: '1.釘釘和企業群裏新建壹個自定義機器人,然後復制 webhook 地址在我們平臺上;\n' + notes: '1.釘釘和企業群裏新建壹個自定義機器人,然後復制 webhook 地址在我們平臺上;\n' +
' 2.機器人選擇為群機器人,安全驗證選擇“自定義關鍵詞” "任務通知";\n' + ' 2.機器人選擇為群機器人,安全驗證選擇“自定義關鍵詞” "任務通知";\n' +
' 3.選擇接收人時必須是妳所建的群裏包含的人,接收人手機號為必填項且為釘釘企業所使用的手機號,', ' 3.選擇接收人時必須是妳所建的群裏包含的人,接收人手機號為必填項且為釘釘企業所使用的手機號,',
message: '事件,接收人,接收方式為必填項', message: '事件,接收人,接收方式為必填項',
message_webhook: '接收方式為釘釘和企業機器人時webhook為必填項', message_webhook: '接收方式為釘釘和企業機器人時webhook為必填項',
template: "模版" template: "模版"
@ -832,8 +833,8 @@ export default {
swagger_export_tip: "通過 Swagger 頁面導出", swagger_export_tip: "通過 Swagger 頁面導出",
suffixFormatErr: "文件格式不符合要求", suffixFormatErr: "文件格式不符合要求",
swagger_url_import: "使用URL導入", swagger_url_import: "使用URL導入",
timing_synchronization:"定時同步", timing_synchronization: "定時同步",
next_synchronization_time:"下次同步時間", next_synchronization_time: "下次同步時間",
}, },
home_page: { home_page: {

View File

@ -174,25 +174,9 @@ export default {
} }
}, },
redirectAuth(authId) { redirectAuth(authId) {
if (authId === 'LDAP' || authId === 'LOCAL') { if (auth.default) {
return; auth.default.redirectAuth(this, authId);
} }
let source = this.authSources.filter(auth => auth.id === authId)[0];
if (source.type === 'CAS') {
return;
}
this.$confirm(this.$t('即将跳转到认证源页面进行认证'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
let config = JSON.parse(source.configuration);
let url = config.authUrl + "/auth?client_id=" + config.clientId + "&redirect_uri=" + config.redirectUrl +
"&response_type=code&scope=openid+profile+email+offline_access&state=" + authId;
window.location.href = url;
}).catch(() => {
this.form.authenticate = 'LOCAL';
});
} }
} }
} }