Skip to content
Snippets Groups Projects
Commit a2f16da8 authored by Andreas Valder's avatar Andreas Valder
Browse files

Merge branch 'master' of git.fsmpi.rwth-aachen.de:videoagwebsite/videoagwebsite

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