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

Cleanup login code

parent 8fd47ad4
......@@ -15,11 +15,9 @@ config['SQLITE_INIT_SCHEMA'] = True
config['SQLITE_INIT_DATA'] = False
config['DEBUG'] = False
config['VIDEOPREFIX'] = 'https://videoag.fsmpi.rwth-aachen.de'
if __name__ == '__main__':
config['SQLITE_INIT_DATA'] = True
config['DEBUG'] = True
config.from_pyfile('config.py', silent=True)
from db import query, searchquery, ldapauth, ldapget
......@@ -144,18 +142,12 @@ def login():
session['user'] = ldapget(user)
else:
flash('Login fehlgeschlagen!')
if 'ref' in request.values:
return redirect(request.values['ref'])
else:
return redirect(url_for('index'))
return redirect(request.values.get('ref', url_for('index')))
@app.route('/logout')
@app.route('/logout', methods=['GET', 'POST'])
def logout():
session.pop('user')
if 'ref' in request.values:
return redirect(request.values['ref'])
else:
return redirect(url_for('index'))
return redirect(request.values.get('ref', url_for('index')))
@app.route('/edit', methods=['GET', 'POST'])
@mod_required
......
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