From 4f44f76ec5a3649dbfec097560b40107da3ecaad Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Mon, 16 Feb 2015 18:26:48 +0000 Subject: Add function for checking authentication status --- run.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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! index ''' +def authenticated(): + if not session.get('logged_in'): + abort(401) + else: + return True + if __name__ == '__main__': app.run(port=app.config['PORT']) -- cgit v1.2.3-70-g09d2