mirror of https://github.com/jumpserver/jumpserver
[Update] 修复网关搜索报500错误;密码为空时,测试连接报500错误
parent
715b04e2b2
commit
a5485011c8
|
@ -27,7 +27,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
|
||||
|
|
|
@ -63,8 +63,9 @@ 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):
|
||||
return False, _("Password should not contain special characters")
|
||||
if self.password is not None:
|
||||
if not re.match(r'\w+$', self.password):
|
||||
return False, _("Password should not contain special characters")
|
||||
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
|
|
Loading…
Reference in New Issue