title: Django 2.1.3 LDAP authentication not authenticating to backend
body: <p>I am trying to create a django(v2.1.3) web app with a simple LDAP authentication. The code runs and i don't exactly know why it isn't working.  It doesn't seem to be authenticating the user info to the LDAP backend i have connected to. When i fill out the form it will always return with "inactive user", when i know the user is on the test server.  All i want is to just have it recognize that it is a "valid user"</p>
  
  <p>I'm running it against a LDAP test server found here <a href="http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/" rel="nofollow noreferrer">http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/</a></p>
  
  <p>here are the changes i've made in the project:</p>
  
  <p>settings.py</p>
  
  <pre><code>import ldap
  from django_auth_ldap.config import LDAPSearch
  
  
  AUTH_LDAP_SERVER_URI = "ldap://ldap.forumsys.com:389"
  AUTH_LDAP_CONNECTION_OPTIONS = {
      ldap.OPT_REFERRALS: 0
  }
  
  AUTH_LDAP_BIND_DN = "cn=read-only-admin,dc=example,dc=com"
  AUTH_LDAP_BIND_PASSWORD = "password"
  AUTH_LDAP_USER_SEARCH = LDAPSearch(
      "dc=example,dc=com",
      ldap.SCOPE_SUBTREE, "(uid=%(user)s)")
  
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  
  AUTHENTICATION_BACKENDS = [
      'django_auth_ldap.backend.LDAPBackend',
  ]
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>from django.contrib.auth import authenticate, login
  from django.shortcuts import render    
  
  def login_user(request):
  
      email = password = ""
      state = ""
  
      if request.POST:
          email = request.POST.get('email')
          password = request.POST.get('password')
  
          print (email, password)
  
          user = authenticate(username=request.POST.get('email'), password=request.POST.get('password'))
          if user is not None:
              login(request, user)
              state = "Valid account"
          else:
              state = "Inactive account"
  
      return render(request, 'KPI/auth.html', {'state': state, 'email': email})
  </code></pre>
  
  <p>auth.html</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Login&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          {{state}}
          &lt;form action="" method="post"&gt; {% csrf_token %}
              Email address: &lt;input type="text" name="email" value="{{ email }}" /&gt;
              Password: &lt;input type="password" name="password" value="" /&gt;
              &lt;input type="submit" value="Log in" /&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>i know the settings configuration is correct because when i run <code>ldapsearch -W -h ldap.forumsys.com -p 389 -D "cn=read-only-admin,dc=example,dc=com" -b "dc=example,dc=com" -s sub "uid=boyle"</code> it will return with just the 'boyle' info</p>
  
  <p>EDIT 2: </p>
  
  <p>I used a logger to get this error when a user comes back as none</p>
  
  <p><code>Caught LDAPError while authenticating tesla: CONNECT_ERROR({'desc': 'Connect error', 'info': 'error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed (self signed certificate in certificate chain)'},)</code></p>