This commit is contained in:
s396355 2019-01-22 16:06:22 +01:00
parent 75752adff0
commit ecebcfc0b5
4 changed files with 4 additions and 3 deletions

5
App.py
View File

@ -65,10 +65,11 @@ def do_login():
password=request.form['password']
ldapquery = py_ldap.LdapQuery(servers, port, root)
auth=ldapquery.authenticate(login+suffix, password)
if auth==True and login == 's396355':
searchstring=ldapquery.search_user(login);
if auth==True and (searchstring[0][0].lower().find('ou=faculty')!=-1 or login == 's396355'):
session['logged_in'] = True
session['user_type'] = 'lecturer'
elif auth==True and login == 's441471':
elif auth==True and searchstring[0][0].lower().find('ou=students')!=-1:
session['logged_in'] = True
session['user_type'] = 'student'
else:

Binary file not shown.

Binary file not shown.

View File

@ -25,7 +25,7 @@ class LdapQuery():
self.root,
ldap.SCOPE_SUBTREE,
'cn=' + login,
['givenname', 'sn', 'mail'])
['givenname', 'sn', 'title', 'mail'])
def authenticate(self, login=None, passwd=None):
try: