Merge pull request #3483 from jumpserver/gateway_search

[Update] 修复网关搜索报500错误;密码为空时,测试连接报500错误
pull/3485/head
BaiJiangJie 2019-12-03 12:07:20 +08:00 committed by GitHub
commit 1876b7dfba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ class DomainViewSet(OrgBulkModelViewSet):
class GatewayViewSet(OrgBulkModelViewSet):
model = Gateway
filter_fields = ("domain__name", "name", "username", "ip", "domain")
filter_fields = ("domain__name", "name", "username", "ip", "domain__id")
search_fields = filter_fields
permission_classes = (IsOrgAdmin,)
serializer_class = serializers.GatewaySerializer

View File

@ -63,7 +63,7 @@ class Gateway(AssetUser):
def test_connective(self, local_port=None):
if local_port is None:
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")
client = paramiko.SSHClient()