diff --git a/about/index.html b/about/index.html index db4744e..27aadce 100644 --- a/about/index.html +++ b/about/index.html @@ -3,7 +3,7 @@ - monotreme.org + About Us - monotreme.org diff --git a/blog/index.html b/blog/index.html index d27a3cc..8ee012e 100644 --- a/blog/index.html +++ b/blog/index.html @@ -3,7 +3,7 @@ - monotreme.org + blog - monotreme.org diff --git a/contact/index.html b/contact/index.html index 3df5e1e..e2e3c66 100644 --- a/contact/index.html +++ b/contact/index.html @@ -3,7 +3,7 @@ - monotreme.org + Contact us! - monotreme.org diff --git a/login/forgot/index.html b/login/forgot/index.html new file mode 100644 index 0000000..2f944f1 --- /dev/null +++ b/login/forgot/index.html @@ -0,0 +1,56 @@ + + + + + + Forgot Password - monotreme.org + + + + + + + + + + + + + + + + + + + + + + +
+

Forgot Password

+
+

Reset your password

+ +
+
+ + +
+ + +
+ +
+
+
+ + diff --git a/login/index.html b/login/index.html index 3e1e0ec..7343162 100644 --- a/login/index.html +++ b/login/index.html @@ -1,69 +1,73 @@ - - - - - - monotreme.org - - - - - - - - + + + + + + monotreme.org + + + +
-

Save the monotremes

-
+ + + + - - - - + + + + - - - - + + + + - - - + echidna + platypus + + - - - - -
+

Save the monotremes

+
-

Login to monotreme.org

- - + +
+

Login to monotreme.org

+ + - echidna - platypus -
- - \ No newline at end of file + + + +

© 2024 monotreme.org

+ + + + + \ No newline at end of file diff --git a/login/register/index.html b/login/register/index.html new file mode 100644 index 0000000..a2aa651 --- /dev/null +++ b/login/register/index.html @@ -0,0 +1,61 @@ + + + + + + Register - monotreme.org + + + + + + + + + + + + + + + + + + + + + + +
+

Register an account

+
+

Create a new account

+ +
+
+ + +
+ + +
+ + +
+ + + +
+
+
+ + diff --git a/monotremes/index.html b/monotremes/index.html index d5378f8..7b6b70a 100644 --- a/monotremes/index.html +++ b/monotremes/index.html @@ -3,7 +3,7 @@ - monotreme.org + About the monotremes - monotreme.org diff --git a/scripts/login.cgi b/scripts/login.cgi new file mode 100644 index 0000000..ccf29a3 --- /dev/null +++ b/scripts/login.cgi @@ -0,0 +1,48 @@ +#!/usr/bin/python3 + +import sqlite3 +import hashlib +import cgi +import os +import http.cookies + +# Get form data +form = cgi.FieldStorage() +username = form.getvalue('username') +password = form.getvalue('password') + +# Connect to SQLite and check credentials +db = sqlite3.connect('/var/lib/monotreme/data/monotreme.db') +cursor = db.cursor() + +# Fetch the user's stored hashed password +cursor.execute("SELECT password_hash FROM users WHERE username=?", (username,)) +result = cursor.fetchone() + +if result: + stored_password_hash = result[0] + # Hash the entered password and compare it + entered_password_hash = hashlib.sha256(password.encode()).hexdigest() + + if entered_password_hash == stored_password_hash: + # Create a session (a simple token could be enough for now) + session_token = hashlib.sha256(os.urandom(32)).hexdigest() + # Set the session cookie + print("Content-Type: text/html") + print(f"Set-Cookie: session_id={session_token}; Path=/; HttpOnly") + print() + + # Show success message or redirect to user panel + print("

Login successful!

") + print("Go to your dashboard") + else: + print("Content-Type: text/html") + print() + print("

Invalid username or password

") +else: + print("Content-Type: text/html") + print() + print("

Invalid username or password

") + +# Close the database connection +db.close() diff --git a/styles.css b/styles.css index efdb077..0ff061f 100644 --- a/styles.css +++ b/styles.css @@ -104,6 +104,18 @@ body { width: 100%; } + .controls { + display: flex; + justify-content: space-between; + text-align: center; + width: 100%; + } + + .controls a { + color: #4682b4; /* Steel blue */ + text-decoration: none; + } + input[type="submit"] { width: auto; padding: 5px 10px;