Unverified Commit 1876b7df authored by BaiJiangJie's avatar BaiJiangJie Committed by GitHub

Merge pull request #3483 from jumpserver/gateway_search

[Update] 修复网关搜索报500错误;密码为空时,测试连接报500错误
parents 873d9098 15b8a2ef
...@@ -29,7 +29,7 @@ class DomainViewSet(OrgBulkModelViewSet): ...@@ -29,7 +29,7 @@ class DomainViewSet(OrgBulkModelViewSet):
class GatewayViewSet(OrgBulkModelViewSet): class GatewayViewSet(OrgBulkModelViewSet):
model = Gateway model = Gateway
filter_fields = ("domain__name", "name", "username", "ip", "domain") filter_fields = ("domain__name", "name", "username", "ip", "domain__id")
search_fields = filter_fields search_fields = filter_fields
permission_classes = (IsOrgAdmin,) permission_classes = (IsOrgAdmin,)
serializer_class = serializers.GatewaySerializer serializer_class = serializers.GatewaySerializer
......
...@@ -63,7 +63,7 @@ class Gateway(AssetUser): ...@@ -63,7 +63,7 @@ class Gateway(AssetUser):
def test_connective(self, local_port=None): def test_connective(self, local_port=None):
if local_port is None: if local_port is None:
local_port = self.port local_port = self.port
if not re.match(r'\w+$', self.password): if self.password and not re.match(r'\w+$', self.password):
return False, _("Password should not contain special characters") return False, _("Password should not contain special characters")
client = paramiko.SSHClient() client = paramiko.SSHClient()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment