From 77f70da475ffed1baa55381ef10bb94154a4ceaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sat, 9 Jun 2018 17:30:05 +0300 Subject: [PATCH] Fix detection of when user is logged in --- server.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server.py b/server.py index c1c17a3..3445775 100644 --- a/server.py +++ b/server.py @@ -44,6 +44,7 @@ class HTTPRequestHandler(http.server.BaseHTTPRequestHandler): # TODO: Do something with the session cookies_string = self.headers['cookie'] + logged_in = False if cookies_string is not None: received_cookies = http.cookies.SimpleCookie() @@ -54,8 +55,15 @@ class HTTPRequestHandler(http.server.BaseHTTPRequestHandler): if 'buranun_session' in received_cookies: print(received_cookies['buranun_session'].value) + logged_in = True + + else: + print('No buranun_session') else: + print('No cookies') + + if not logged_in: # Display page that tells user to login # TODO: Have it forward the user back to the page where they were at html = generate_html.login_forward(self.path)