diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-02-16 18:24:08 +0000 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-02-16 18:24:08 +0000 |
commit | a0c8d819cd002f15c8a4ccc3f7262736c7a3bfdd (patch) | |
tree | 37ccfdcf53cf90aa4d38c3ad76c13b0e52ecbfd3 | |
parent | 8e83e9668f9c0d7429f759496642bee94951bb6b (diff) | |
download | znc-log-viewer-a0c8d819cd002f15c8a4ccc3f7262736c7a3bfdd.tar.xz |
Add page for logging in
-rwxr-xr-x | run.py | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -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']) |