diff --git a/apps/assets/models/domain.py b/apps/assets/models/domain.py index af3fe612f..b89c3b128 100644 --- a/apps/assets/models/domain.py +++ b/apps/assets/models/domain.py @@ -63,9 +63,8 @@ class Gateway(AssetUser): def test_connective(self, local_port=None): if local_port is None: local_port = self.port - if self.password is not None: - if not re.match(r'\w+$', self.password): - return False, _("Password should not contain special characters") + if self.password and 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())