Commit b420a344 authored by Julian Rother's avatar Julian Rother
Browse files

Implemented ldap login

parent 77c1e2cb
......@@ -3,7 +3,7 @@ from flask import Flask, render_template, g, request, url_for, redirect, session
import mysql.connector
import sqlite3
import os
#import ldap3
import ldap3
import re
app = Flask(__name__)
......@@ -152,5 +152,12 @@ def course():
else:
return redirect(url_for('index'))
@app.route('/login', methods=['POST'])
def login():
user, groups = ldapauth(request.form.get('user'), request.form.get('password'))
if user and 'user' in groups:
session.user = user
return redirect(request.form.get('ref'))
if __name__ == '__main__':
app.run()
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