Skip to content
Snippets Groups Projects
Commit 315a05c9 authored by theneedyguy's avatar theneedyguy Committed by GitHub
Browse files

Fix for python3

This fixes an attribute error
parent c2467322
Branches
Tags
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import re import re
from functools import wraps from functools import wraps
import ldap import ldap
import sys
from ldap import filter as ldap_filter from ldap import filter as ldap_filter
from flask import abort, current_app, g, make_response, redirect, url_for, \ from flask import abort, current_app, g, make_response, redirect, url_for, \
request request
...@@ -149,6 +150,9 @@ class LDAP(object): ...@@ -149,6 +150,9 @@ class LDAP(object):
return return
try: try:
conn = self.initialize conn = self.initialize
if sys.version_info[0] > 2:
conn.simple_bind_s(user_dn, password)
else:
conn.simple_bind_s(user_dn.decode('utf-8'), password) conn.simple_bind_s(user_dn.decode('utf-8'), password)
return True return True
except ldap.LDAPError: except ldap.LDAPError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment