Skip to content
Snippets Groups Projects
Commit a054f444 authored by Julian Rother's avatar Julian Rother
Browse files

Fixed handling of unset L2P_APIKEY, closes #68

parent bdfe0846
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,8 @@ def oauthget(endpoint, **args):
@app.route('/l2pauth')
def start_l2pauth():
if 'L2P_APIKEY' not in config:
return render_template("500.html"), 500
code = oauthget('code', scope='l2p2013.rwth')
session['oauthcode'] = code['device_code']
session['oauthscope'] = 'l2p'
......@@ -23,6 +25,8 @@ def start_l2pauth():
@app.route('/rwthauth')
def start_rwthauth():
if 'L2P_APIKEY' not in config:
return render_template("500.html"), 500
code = oauthget('code', scope='userinfo.rwth')
session['oauthcode'] = code['device_code']
session['oauthscope'] = 'rwth'
......@@ -30,6 +34,8 @@ def start_rwthauth():
@app.before_request
def finish_oauth():
if 'L2P_APIKEY' not in config:
return
if 'oauthcode' not in session or 'oauthscope' not in session:
return
token = oauthget('token', code=session['oauthcode'], grant_type='device')
......
......@@ -572,7 +572,6 @@ import importer
import sorter
if 'ICAL_URL' in config:
import meetings
if 'L2P_APIKEY' in config:
import l2pauth
import jobs
import timetable
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment