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
if not obj: obj = "Anonymous"
if not obj: obj = "ANONYMOUS "
ID = obj
NAME = obj[-10:]

View file

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

View file

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