Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gjl2004yn
jumpserver
提交
1c0ad08d
J
jumpserver
项目概览
gjl2004yn
/
jumpserver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jumpserver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
1c0ad08d
编写于
6月 10, 2020
作者:
E
Eric_Lee
提交者:
GitHub
6月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ldap test i18n msg (#4092)
上级
e1ab4537
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
24 deletion
+24
-24
apps/settings/utils/ldap.py
apps/settings/utils/ldap.py
+24
-24
未找到文件。
apps/settings/utils/ldap.py
浏览文件 @
1c0ad08d
...
...
@@ -386,13 +386,13 @@ class LDAPTestUtil(object):
try
:
self
.
_test_server_uri
()
except
LDAPSocketOpenError
as
e
:
error
=
_
(
"Host or port is disconnected: {}"
.
format
(
e
)
)
error
=
_
(
"Host or port is disconnected: {}"
).
format
(
e
)
except
LDAPSessionTerminatedByServerError
as
e
:
error
=
_
(
'The port is not the port of the LDAP service: {}'
.
format
(
e
)
)
error
=
_
(
'The port is not the port of the LDAP service: {}'
).
format
(
e
)
except
LDAPSocketReceiveError
as
e
:
error
=
_
(
'Please add certificate: {}'
.
format
(
e
)
)
error
=
_
(
'Please add certificate: {}'
).
format
(
e
)
except
Exception
as
e
:
error
=
_
(
'Unknown error: {}'
.
format
(
e
)
)
error
=
_
(
'Unknown error: {}'
).
format
(
e
)
else
:
return
raise
LDAPInvalidServerError
(
error
)
...
...
@@ -413,13 +413,13 @@ class LDAPTestUtil(object):
try
:
self
.
_test_bind_dn
()
except
LDAPUserNameIsMandatoryError
as
e
:
error
=
_
(
'Please enter Bind DN: {}'
.
format
(
e
)
)
error
=
_
(
'Please enter Bind DN: {}'
).
format
(
e
)
except
LDAPPasswordIsMandatoryError
as
e
:
error
=
_
(
'Please enter Password: {}'
.
format
(
e
)
)
error
=
_
(
'Please enter Password: {}'
).
format
(
e
)
except
LDAPInvalidDnError
as
e
:
error
=
_
(
'Please enter correct Bind DN and Password: {}'
.
format
(
e
)
)
error
=
_
(
'Please enter correct Bind DN and Password: {}'
).
format
(
e
)
except
Exception
as
e
:
error
=
_
(
'Unknown error: {}'
.
format
(
e
)
)
error
=
_
(
'Unknown error: {}'
).
format
(
e
)
else
:
return
raise
LDAPBindError
(
error
)
...
...
@@ -433,9 +433,9 @@ class LDAPTestUtil(object):
for
search_ou
in
search_ous
:
util
.
config
.
search_ou
=
search_ou
user_entries
=
util
.
search_user_entries
()
logger
.
debug
(
'Search ou: {}, count user: {}'
.
format
(
search_ou
,
len
(
user_entries
)
))
logger
.
debug
(
'Search ou: {}, count user: {}'
).
format
(
search_ou
,
len
(
user_entries
))
if
len
(
user_entries
)
==
0
:
error
=
_
(
'Invalid User OU or User search filter: {}'
.
format
(
search_ou
)
)
error
=
_
(
'Invalid User OU or User search filter: {}'
).
format
(
search_ou
)
raise
self
.
LDAPInvalidSearchOuOrFilterError
(
error
)
def
test_search_ou_and_filter
(
self
):
...
...
@@ -449,7 +449,7 @@ class LDAPTestUtil(object):
error
=
e
raise
self
.
LDAPInvalidAttributeMapError
(
error
)
except
Exception
as
e
:
error
=
_
(
'Unknown error: {}'
.
format
(
e
)
)
error
=
_
(
'Unknown error: {}'
).
format
(
e
)
else
:
return
raise
self
.
LDAPInvalidSearchOuOrFilterError
(
error
)
...
...
@@ -466,7 +466,7 @@ class LDAPTestUtil(object):
actually_contain_attr
=
set
(
attr_map
.
keys
())
result
=
should_contain_attr
-
actually_contain_attr
if
len
(
result
)
!=
0
:
error
=
_
(
'LDAP User attr map not include: {}'
.
format
(
result
)
)
error
=
_
(
'LDAP User attr map not include: {}'
).
format
(
result
)
raise
self
.
LDAPInvalidAttributeMapError
(
error
)
def
test_attr_map
(
self
):
...
...
@@ -477,7 +477,7 @@ class LDAPTestUtil(object):
except
self
.
LDAPInvalidAttributeMapError
as
e
:
error
=
e
except
Exception
as
e
:
error
=
_
(
'Unknown error: {}'
.
format
(
e
)
)
error
=
_
(
'Unknown error: {}'
).
format
(
e
)
else
:
return
raise
self
.
LDAPInvalidAttributeMapError
(
error
)
...
...
@@ -510,20 +510,20 @@ class LDAPTestUtil(object):
try
:
self
.
_test_config
()
except
LDAPInvalidServerError
as
e
:
msg
=
_
(
'Error (Invalid LDAP server): {}'
.
format
(
e
)
)
msg
=
_
(
'Error (Invalid LDAP server): {}'
).
format
(
e
)
except
LDAPBindError
as
e
:
msg
=
_
(
'Error (Invalid Bind DN): {}'
.
format
(
e
)
)
msg
=
_
(
'Error (Invalid Bind DN): {}'
).
format
(
e
)
except
self
.
LDAPInvalidAttributeMapError
as
e
:
msg
=
_
(
'Error (Invalid LDAP User attr map): {}'
.
format
(
e
)
)
msg
=
_
(
'Error (Invalid LDAP User attr map): {}'
).
format
(
e
)
except
self
.
LDAPInvalidSearchOuOrFilterError
as
e
:
msg
=
_
(
'Error (Invalid User OU or User search filter): {}'
.
format
(
e
)
)
msg
=
_
(
'Error (Invalid User OU or User search filter): {}'
).
format
(
e
)
except
self
.
LDAPNotEnabledAuthError
as
e
:
msg
=
_
(
'Error (Not enabled LDAP authentication): {}'
.
format
(
e
)
)
msg
=
_
(
'Error (Not enabled LDAP authentication): {}'
).
format
(
e
)
except
Exception
as
e
:
msg
=
_
(
'Error (Unknown): {}'
).
format
(
e
)
else
:
status
=
True
msg
=
_
(
'Succeed: Match {} s user'
.
format
(
len
(
self
.
user_entries
)
))
msg
=
_
(
'Succeed: Match {} s user'
).
format
(
len
(
self
.
user_entries
))
if
not
status
:
logger
.
error
(
msg
,
exc_info
=
True
)
...
...
@@ -556,16 +556,16 @@ class LDAPTestUtil(object):
try
:
self
.
_test_login
(
username
,
password
)
except
LDAPConfigurationError
as
e
:
msg
=
_
(
'Authentication failed (configuration incorrect): {}'
.
format
(
e
)
)
msg
=
_
(
'Authentication failed (configuration incorrect): {}'
).
format
(
e
)
except
self
.
LDAPBeforeLoginCheckError
as
e
:
msg
=
_
(
'Authentication failed (before login check failed): {}'
.
format
(
e
)
)
msg
=
_
(
'Authentication failed (before login check failed): {}'
).
format
(
e
)
except
LDAPUser
.
AuthenticationFailed
as
e
:
msg
=
_
(
'Authentication failed (username or password incorrect): {}'
.
format
(
e
)
)
msg
=
_
(
'Authentication failed (username or password incorrect): {}'
).
format
(
e
)
except
Exception
as
e
:
msg
=
_
(
"Authentication failed (Unknown): {}"
.
format
(
e
)
)
msg
=
_
(
"Authentication failed (Unknown): {}"
).
format
(
e
)
else
:
status
=
True
msg
=
_
(
"Authentication success: {}"
.
format
(
username
)
)
msg
=
_
(
"Authentication success: {}"
).
format
(
username
)
if
not
status
:
logger
.
error
(
msg
,
exc_info
=
True
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录