diff --git a/backend/apps/system/crud/assistant.py b/backend/apps/system/crud/assistant.py index 5d731847..1f1e5ec6 100644 --- a/backend/apps/system/crud/assistant.py +++ b/backend/apps/system/crud/assistant.py @@ -1,4 +1,5 @@ import json +import re import urllib from typing import Optional @@ -142,15 +143,20 @@ def get_ds_from_api(self): raise Exception(f"Failed to get datasource list from {endpoint}, error: {result_json.get('message')}") else: raise Exception(f"Failed to get datasource list from {endpoint}, status code: {res.status_code}") - + + def get_first_element(self, text: str): + parts = re.split(r'[,;]', text.strip()) + first_domain = parts[0].strip() + return first_domain + def get_complete_endpoint(self, endpoint: str) -> str | None: if endpoint.startswith("http://") or endpoint.startswith("https://"): return endpoint domain_text = self.assistant.domain if not domain_text: return None - if ',' in domain_text: - return (self.request_origin.strip('/') if self.request_origin else domain_text.split(',')[0].strip('/')) + endpoint + if ',' in domain_text or ';' in domain_text: + return (self.request_origin.strip('/') if self.request_origin else self.get_first_element(domain_text).strip('/')) + endpoint else: return f"{domain_text}{endpoint}" diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 259afd4b..e36d0874 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -764,7 +764,8 @@ "ou_placeholder": "Example: ou=users,dc=example,dc=com", "user_filter": "User Filter", "user_filter_placeholder": "Example: uid", - "ldap_field_mapping_placeholder": "Example: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}" + "ldap_field_mapping_placeholder": "Example: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}", + "be_turned_on": "Once the test connection is confirmed to be effective, it can be enabled" }, "login": { "default_login": "Default", diff --git a/frontend/src/i18n/ko-KR.json b/frontend/src/i18n/ko-KR.json index a79aa92e..485b5b57 100644 --- a/frontend/src/i18n/ko-KR.json +++ b/frontend/src/i18n/ko-KR.json @@ -764,7 +764,8 @@ "ou_placeholder": "예: ou=users,dc=example,dc=com", "user_filter": "사용자 필터", "user_filter_placeholder": "예: uid", - "ldap_field_mapping_placeholder": "예: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}" + "ldap_field_mapping_placeholder": "예: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}", + "be_turned_on": "테스트 연결이 유효한 것으로 확인되면 활성화할 수 있습니다" }, "login": { "default_login": "기본값", diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index 65917ec8..31c8f233 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -764,7 +764,8 @@ "ou_placeholder": "例如:ou=users,dc=example,dc=com", "user_filter": "用户过滤器", "user_filter_placeholder": "例如:uid", - "ldap_field_mapping_placeholder": "例如:{'{'}\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"{'}'}" + "ldap_field_mapping_placeholder": "例如:{'{'}\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"{'}'}", + "be_turned_on": "测试连接有效后,可开启" }, "login": { "default_login": "默认", diff --git a/frontend/src/views/system/authentication/index.vue b/frontend/src/views/system/authentication/index.vue index de381854..d0349a2b 100644 --- a/frontend/src/views/system/authentication/index.vue +++ b/frontend/src/views/system/authentication/index.vue @@ -23,7 +23,7 @@ v-if="!item.valid" class="box-item" effect="dark" - :content="t('system.be_turned_on')" + :content="t('authentication.be_turned_on')" placement="top" >