ldap first pass
This commit is contained in:
parent
3c2f4a0445
commit
2eaf09dc78
13 changed files with 148 additions and 25 deletions
18
realms/modules/auth/ldap/views.py
Normal file
18
realms/modules/auth/ldap/views.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from flask import current_app, request, redirect, Blueprint, flash, url_for
|
||||
from ..ldap.models import User
|
||||
from flask_ldap_login import LDAPLoginForm
|
||||
|
||||
blueprint = Blueprint('auth.ldap', __name__)
|
||||
|
||||
@blueprint.route("/login/ldap", methods=['POST'])
|
||||
def login():
|
||||
form = LDAPLoginForm()
|
||||
|
||||
if not form.validate():
|
||||
flash('Form invalid', 'warning')
|
||||
return redirect(url_for('auth.login'))
|
||||
|
||||
if User.auth(form.user):
|
||||
return redirect(request.args.get("next") or url_for(current_app.config['ROOT_ENDPOINT']))
|
||||
else:
|
||||
return redirect(url_for('auth.login'))
|
Loading…
Add table
Add a link
Reference in a new issue