Mercurial > libervia-web
comparison libervia/web/pages/_browser/jid.py @ 1572:7006b55001a4
broweser (jid): add a simple check for JID validation.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 22 Nov 2023 16:31:36 +0100 |
parents | b338c31d5251 |
children |
comparison
equal
deleted
inserted
replaced
1571:ff633e19a069 | 1572:7006b55001a4 |
---|---|
87 def is_valid(self) -> bool: | 87 def is_valid(self) -> bool: |
88 """ | 88 """ |
89 @return: True if the JID is XMPP compliant | 89 @return: True if the JID is XMPP compliant |
90 """ | 90 """ |
91 # Simple check for domain part | 91 # Simple check for domain part |
92 if not self.domain or self.domain.startswith(".") or self.domain.endswith("."): | 92 if ( |
93 not self.domain | |
94 or self.domain.startswith(".") | |
95 or self.domain.endswith(".") | |
96 or "." not in self.domain | |
97 ): | |
93 return False | 98 return False |
94 if ".." in self.domain: | 99 if ".." in self.domain: |
95 return False | 100 return False |
96 return True | 101 return True |
97 | 102 |