Lucterios2 / django_auth_ldap3_ad

Simple LDAP/AD auth module for django
https://pypi.python.org/pypi/django-auth-ldap3-ad
GNU General Public License v3.0
45 stars 25 forks source link

ldap3.core.exceptions.LDAPInvalidPortError: port must be an integer #36

Closed Starman1984 closed 3 years ago

Starman1984 commented 3 years ago

django 3.1 python 3.9.6 ...lib\site-packages\ldap3\core\server.py", line 118 try: port = int(hostport) or port except ValueError: if log_enabled(ERROR): log(ERROR, 'port <%s> must be an integer', port) raise LDAPInvalidPortError('port must be an integer')

settings: LDAP_SERVERS = [ { 'host': 'confidential', 'port': 389, #also tried init(389), still fails 'use_ssl': False, 'get_info': 'NONE', }, ]

class Login(View): template = 'login.html'

def get(self, request):
    _form = AuthenticationForm()
    return render(request, self.template, {'form': _form})

def post(self, request, *args, **kwargs):
    _form = AuthenticationForm(request.POST)
    _username = request.POST['username']
    _password = request.POST['password']
    _user = authenticate(request, username=_username, password=_password)
    if _user is not None:
        login(request, _user)
        return HttpResponseRedirect('/')
    else:
        return render(request, self.template, {'form': _form})  
Starman1984 commented 3 years ago

Issue resolved, changed host setting to ip address

KDR9666 commented 8 months ago

Issue resolved, changed host setting to ip address

Please help me, same issue