From 3d4a06df18e7cac53c3229cde19ddd13eae1f8cb Mon Sep 17 00:00:00 2001 From: Tristan Smith Date: Sun, 22 Sep 2024 14:07:54 -0400 Subject: [PATCH] building login --- about/index.html | 1 + blog/index.html | 1 + contact/index.html | 1 + echidna/index.html | 1 + index.html | 1 + login/forgot/index.html | 2 +- login/index.html | 1 + monotremes/index.html | 1 + platypus/index.html | 1 + scripts/forgot_password.cgi | 2 +- scripts/reset_password.cgi | 78 ++++++++++++++++++------------------- 11 files changed, 49 insertions(+), 41 deletions(-) diff --git a/about/index.html b/about/index.html index 27aadce..1694ad0 100644 --- a/about/index.html +++ b/about/index.html @@ -22,6 +22,7 @@ About Blog Contact + Login diff --git a/blog/index.html b/blog/index.html index 8ee012e..b384554 100644 --- a/blog/index.html +++ b/blog/index.html @@ -22,6 +22,7 @@ About Blog Contact + Login diff --git a/contact/index.html b/contact/index.html index e2e3c66..8919813 100644 --- a/contact/index.html +++ b/contact/index.html @@ -22,6 +22,7 @@ About Blog Contact + Login diff --git a/echidna/index.html b/echidna/index.html index 55bd220..973a903 100644 --- a/echidna/index.html +++ b/echidna/index.html @@ -22,6 +22,7 @@ About Blog Contact + Login diff --git a/index.html b/index.html index 6cec57d..336afa0 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,7 @@ About Blog Contact + Login diff --git a/login/forgot/index.html b/login/forgot/index.html index 974142f..4f86ba1 100644 --- a/login/forgot/index.html +++ b/login/forgot/index.html @@ -41,7 +41,7 @@
- + diff --git a/login/index.html b/login/index.html index 60b3908..935310e 100644 --- a/login/index.html +++ b/login/index.html @@ -22,6 +22,7 @@ About Blog Contact + Login diff --git a/monotremes/index.html b/monotremes/index.html index 7b6b70a..2c20255 100644 --- a/monotremes/index.html +++ b/monotremes/index.html @@ -22,6 +22,7 @@ About Blog Contact + Login diff --git a/platypus/index.html b/platypus/index.html index 268a240..9856bc7 100644 --- a/platypus/index.html +++ b/platypus/index.html @@ -22,6 +22,7 @@ About Blog Contact + Login diff --git a/scripts/forgot_password.cgi b/scripts/forgot_password.cgi index b8033e9..e8ceb6a 100644 --- a/scripts/forgot_password.cgi +++ b/scripts/forgot_password.cgi @@ -56,7 +56,7 @@ EXPIRATION=$(($(date +%s) + 3600)) sqlite3 $DB_PATH "UPDATE users SET reset_token='$TOKEN', reset_expires=$EXPIRATION WHERE username='$USERNAME';" # Send reset link email -RESET_LINK="https://monotreme.org/cgi-bin/reset_password.cgi?token=$TOKEN" +RESET_LINK="https://monotreme.org/cgi-bin/reset_password.cgi?token=$TOKEN" EMAIL_BODY=$(cat < strftime('%s','now');") + # Check if the token exists and is valid (not expired) + DB_PATH="/var/lib/monotreme/data/monotreme.db" + VALID_TOKEN=$(sqlite3 $DB_PATH "SELECT COUNT(*) FROM users WHERE reset_token='$TOKEN' AND reset_expires > strftime('%s','now');") -if [ "$VALID_TOKEN" -eq 0 ]; then + if [ "$VALID_TOKEN" -eq 0 ]; then + cat < + Invalid Token + +

Invalid or expired token!

+ Request a new reset link + + + EOF + exit 1 + fi + + # Display reset form cat < -Invalid Token - -

Invalid or expired token!

-Request a new reset link - - -EOF - exit 1 -fi - -# Display reset form -cat < -Reset Your Password - -

Reset Your Password

-
- - - -
- - -
- -
- - -EOF + + Reset Your Password + +

Reset Your Password

+
+ + + +
+ + +
+ +
+ + + EOF