summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-02-16 18:26:48 +0000
committerJohannes Löthberg <johannes@kyriasis.com>2015-02-16 18:26:48 +0000
commit4f44f76ec5a3649dbfec097560b40107da3ecaad (patch)
treebc8e4121f228225810a466482ae0e9f0556eb5b4
parenta0c8d819cd002f15c8a4ccc3f7262736c7a3bfdd (diff)
downloadznc-log-viewer-4f44f76ec5a3649dbfec097560b40107da3ecaad.tar.xz
Add function for checking authentication status
-rwxr-xr-xrun.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/run.py b/run.py
index 6de0c08..926b555 100755
--- a/run.py
+++ b/run.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from flask import Flask, send_from_directory, render_template, url_for
+from flask import Flask, send_from_directory, render_template, session, abort
from flask_kerberos import init_kerberos, requires_authentication
from classes import Network, Channel, Log
from urllib.parse import quote_plus
@@ -98,5 +98,11 @@ def login(principal):
Logged in! <a href="/">index</a>
'''
+def authenticated():
+ if not session.get('logged_in'):
+ abort(401)
+ else:
+ return True
+
if __name__ == '__main__':
app.run(port=app.config['PORT'])