Commit 38d3345c authored by Julian Rother's avatar Julian Rother
Browse files

Added user indication

parent 56c9bde6
......@@ -90,6 +90,19 @@ def ldapauth(user, password):
return user, notldap[user][1]
return None, []
def ldapget(user):
notldap = {'videoag': {'uid': 'videoag', 'givenName': 'Video', 'sn': 'Geier'},
'gustav': {'uid': 'gustav', 'givenName': 'Gustav', 'sn': 'Geier'}}
user = LDAP_USERRE.sub(r'', user.lower())
if 'LDAP_HOST' in config:
conn = ldap3.Connection('ldaps://', auto_bind=True)"ou=users,dc=fsmpi,dc=rwth-aachen,dc=de", "(uid=%s)"%user,
e = conn.entries[0]
return {'uid': user, 'givenName': e.givenName.value, 'sn'}
return notldap[user]
def index():
return render_template('index.html', latestvideos=query('''
......@@ -156,7 +169,7 @@ def course():
def login():
user, groups = ldapauth(request.form.get('user'), request.form.get('password'))
if user and 'users' in groups:
session['user'] = user
session['user'] = ldapget(user)
if 'ref' in request.values:
return redirect(request.values['ref'])
......@@ -71,6 +71,7 @@
{% else %}
<a href="/logout?ref={{ request.url|urlencode }}">
{{ session.user.givenName }}
<span class="glyphicon glyphicon-log-out"></span>
{% endif %}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment