def isValidWithMsg(self): if not self.controller_ip: return False, tr("Please specify the authentication server(s).") ok, msg = _ad_valid_passwordserver(self.controller_ip) if not ok: return False, msg if not self.domain: return False, tr("Please specify the domain name.") if not self.user: return False, tr("Please specify the user name used to join the domain.") if "\\" in self.user: return False, tr("Do not specify the domain in the user name.") if not self.password: return False, tr("Please specify the password used to join the domain.") if not check_domain(self.domain): return False, tr("Invalid domain.") if not check_hostname(self.workgroup): return False, tr("Invalid workgroup name.") return True, ''
def isInvalid(self): if self.domain and not check_domain(self.domain): return "domain is invalid" if not self.nameserver1 and not self.nameserver2: return "one name server required" if self.nameserver1 == self.nameserver2: return "nameservers 1 and 2 are identical" for value in (self.nameserver1, self.nameserver2): if value: error = "invalid IP: '%s'" % value if not check_ip(value): return error try: dns = IP(value) except: return error return False
def check_domain(self, value): return check_domain(value)