Fix detection of when user is logged in
This commit is contained in:
parent
0187775332
commit
77f70da475
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue