diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-02-16 18:26:48 +0000 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-02-16 18:26:48 +0000 |
commit | 4f44f76ec5a3649dbfec097560b40107da3ecaad (patch) | |
tree | bc8e4121f228225810a466482ae0e9f0556eb5b4 | |
parent | a0c8d819cd002f15c8a4ccc3f7262736c7a3bfdd (diff) | |
download | znc-log-viewer-4f44f76ec5a3649dbfec097560b40107da3ecaad.tar.xz |
Add function for checking authentication status
-rwxr-xr-x | run.py | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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']) |