summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-02-16 18:24:08 +0000
committerJohannes Löthberg <johannes@kyriasis.com>2015-02-16 18:24:08 +0000
commita0c8d819cd002f15c8a4ccc3f7262736c7a3bfdd (patch)
tree37ccfdcf53cf90aa4d38c3ad76c13b0e52ecbfd3
parent8e83e9668f9c0d7429f759496642bee94951bb6b (diff)
downloadznc-log-viewer-a0c8d819cd002f15c8a4ccc3f7262736c7a3bfdd.tar.xz
Add page for logging in
-rwxr-xr-xrun.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/run.py b/run.py
index 2608212..6de0c08 100755
--- a/run.py
+++ b/run.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
from flask import Flask, send_from_directory, render_template, url_for
-from flask_kerberos import init_kerberos
+from flask_kerberos import init_kerberos, requires_authentication
from classes import Network, Channel, Log
from urllib.parse import quote_plus
import sys, os
@@ -83,5 +83,20 @@ def get_log(network_name, channel_name, log_file):
def send_static(filename):
return send_from_directory('static', filename)
+@app.route('/login')
+@requires_authentication
+def login(principal):
+ if principal == 'kyrias@KYRIASIS.COM':
+ session['logged_in'] = True
+
+ else:
+ session.pop('logged_in', None)
+ return abort(401)
+
+ if session['logged_in']:
+ return '''
+ Logged in! <a href="/">index</a>
+ '''
+
if __name__ == '__main__':
app.run(port=app.config['PORT'])