diff --git a/images/65b3ae93-cfd3-47a8-ab3d-5db542a3f0e7.webp b/images/65b3ae93-cfd3-47a8-ab3d-5db542a3f0e7.webp new file mode 100644 index 0000000..9c950a9 Binary files /dev/null and b/images/65b3ae93-cfd3-47a8-ab3d-5db542a3f0e7.webp differ diff --git a/login/index.html b/login/index.html index 7343162..60b3908 100644 --- a/login/index.html +++ b/login/index.html @@ -41,7 +41,7 @@

Login to monotreme.org

-
+
diff --git a/login/register/index.html b/login/register/index.html index 1785ae0..2ae3922 100644 --- a/login/register/index.html +++ b/login/register/index.html @@ -36,6 +36,9 @@
+ + +

@@ -45,6 +48,7 @@
+
diff --git a/readme.md b/readme.md index 75c0615..1f13a11 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,3 @@ ## monotreme.org -A joke site +A joke site that I'm putting entierly too much effort into. Like, seriously, I'm spending way too much time on this. I should be working on [fddl](https://git.fddl.dev/fddl/fddl). \ No newline at end of file diff --git a/scripts/register.cgi b/scripts/register.cgi new file mode 100644 index 0000000..b16edae --- /dev/null +++ b/scripts/register.cgi @@ -0,0 +1,92 @@ + #!/bin/bash + + echo "Content-type: text/html" + echo "" + + # Log the raw POST data for debugging + read POST_DATA + echo "POST Data: $POST_DATA" >> /tmp/register_form.log + + # URL decoding function + urldecode() { + local url_encoded="${1//+/ }" + printf '%b' "${url_encoded//%/\\x}" + } + + # Parse the form data using IFS + USERNAME="" + EMAIL="" + PASSWORD="" + CONFIRM_PASSWORD="" + + IFS='&' # Split fields by "&" + for param in $POST_DATA; do + IFS='=' read -r key value <<< "$param" + key=$(urldecode "$key") + value=$(urldecode "$value") + + case $key in + username) USERNAME="$value" ;; + email) EMAIL="$value" ;; + password) PASSWORD="$value" ;; + confirm_password) CONFIRM_PASSWORD="$value" ;; + esac + done + + # Check if passwords match + if [ "$PASSWORD" != "$CONFIRM_PASSWORD" ]; then + cat < + Registration Failed + +

Passwords do not match!

+ Go back + + + EOF + exit 1 + fi + + # Hash the password using SHA-256 + PASSWORD_HASH=$(echo -n "$PASSWORD" | sha256sum | awk '{print $1}') + + # Insert the user into the SQLite database + DB_PATH="/var/lib/monotreme/data/monotreme.db" + sqlite3 $DB_PATH "INSERT INTO users (username, email, password_hash) VALUES ('$USERNAME', '$EMAIL', '$PASSWORD_HASH');" 2>> /tmp/register_form.log + + # Log the username and email for debugging + echo "Username: $USERNAME, Email: $EMAIL" >> /tmp/register_form.log + + # Create the email with proper headers + EMAIL_BODY=$(cat <> /tmp/register_form.log + + # Send the email using msmtp (or your protonmail-bridge setup) + echo "$EMAIL_BODY" | msmtp --from=default "$EMAIL" + + # Response back to the browser + cat < + Registration Successful + +

Registration successful!

+

A confirmation email has been sent to $EMAIL.

+ Go to login page + + + EOF diff --git a/styles.css b/styles.css index fb51f7a..afe6e97 100644 --- a/styles.css +++ b/styles.css @@ -79,31 +79,6 @@ body { vertical-align: top; } - .login { - width: 200px; - margin: 0 auto; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - padding: 20px; - background-color: #eeeeee; - /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); */ - } - - .login form { - display: flex; - flex-direction: column; - width: 100%; - align-items: center; - } - - .login label, - .login input { - margin: 5px 0; - width: 100%; - } - .form-container { width: 200px; margin: 0 auto; @@ -113,7 +88,7 @@ body { align-items: center; padding: 20px; background-color: #eeeeee; - /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); */ + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } .form-container form {