Worked out authentication bug

This commit is contained in:
BlenderDumbass 2024-11-25 00:04:12 +02:00
parent c5eef007aa
commit 97610443a3
3 changed files with 6 additions and 8 deletions

View file

@ -88,7 +88,7 @@ def consoleForm(obj):
# Function that prints a pretty object info about # Function that prints a pretty object info about
if not obj: obj = "Anonymous" if not obj: obj = "ANONYMOUS "
ID = obj ID = obj
NAME = obj[-10:] NAME = obj[-10:]

View file

@ -29,15 +29,12 @@ def guess_type(path):
def headers(server, code): def headers(server, code):
# Basic cookie for logins to work # Basic cookie for logins to work
cookie = False
if "Cookie" not in str(server.headers):
cookie = True
server.send_response(code) server.send_response(code)
server.send_header("Content-type", guess_type(server.path)) server.send_header("Content-type", guess_type(server.path))
if cookie: if not server.cookie:
server.send_header("Set-Cookie", RandString()) server.send_header("Set-Cookie", "temp_id="+RandString())
server.end_headers() server.end_headers()
@ -742,8 +739,8 @@ def RegisterPage(server):
wrongcode = server.parsed.get("wrongcode", [""])[0] wrongcode = server.parsed.get("wrongcode", [""])[0]
# Generating <head> # Generating <head>
html = head(title = "Login", html = head(title = "Register",
description = "Login", description = "Register",
config = config config = config
) )

View file

@ -50,6 +50,7 @@ class handler(BaseHTTPRequestHandler):
self.parsed = urllib.parse.parse_qs(parsed_url.query) self.parsed = urllib.parse.parse_qs(parsed_url.query)
self.cookie = self.headers.get("Cookie") self.cookie = self.headers.get("Cookie")
if self.cookie: self.cookie = self.cookie[-50:]
categories = list(Render.tabs().keys()) categories = list(Render.tabs().keys())