diff options
Diffstat (limited to 'newspipe/controllers/user.py')
-rw-r--r-- | newspipe/controllers/user.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/newspipe/controllers/user.py b/newspipe/controllers/user.py index 00ffb96a..54137794 100644 --- a/newspipe/controllers/user.py +++ b/newspipe/controllers/user.py @@ -5,6 +5,7 @@ import ldap3 from ldap3.core.exceptions import LDAPBindError from werkzeug.security import check_password_hash from werkzeug.security import generate_password_hash +from urllib.parse import urlparse from .abstract import AbstractController from newspipe.bootstrap import application @@ -17,6 +18,11 @@ from newspipe.models import User logger = logging.getLogger(__name__) +# FOR LDAP +# Reference: session_app +import ldap3 +from ldap3.core.exceptions import LDAPBindError, LDAPPasswordIsMandatoryError + class UserController(AbstractController): _db_cls = User @@ -138,7 +144,7 @@ class LdapuserController: namelist = [] try: query = dns.resolver.query(f"_ldap._tcp.{domain}", "SRV") - except dns.resolver.NXDOMAIN: + except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): # no records exist that match the request, so we were probably # given a specific hostname, and an empty query will trigger # the logic below that will add the original domain to the list. |