building login
This commit is contained in:
parent
7a008bb795
commit
3d4a06df18
11 changed files with 49 additions and 41 deletions
|
@ -22,6 +22,7 @@
|
||||||
<a href="/about/">About</a>
|
<a href="/about/">About</a>
|
||||||
<a href="/blog/">Blog</a>
|
<a href="/blog/">Blog</a>
|
||||||
<a href="/contact/">Contact</a>
|
<a href="/contact/">Contact</a>
|
||||||
|
<a href="/login/">Login</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<a href="/about/">About</a>
|
<a href="/about/">About</a>
|
||||||
<a href="/blog/">Blog</a>
|
<a href="/blog/">Blog</a>
|
||||||
<a href="/contact/">Contact</a>
|
<a href="/contact/">Contact</a>
|
||||||
|
<a href="/login/">Login</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<a href="/about/">About</a>
|
<a href="/about/">About</a>
|
||||||
<a href="/blog/">Blog</a>
|
<a href="/blog/">Blog</a>
|
||||||
<a href="/contact/">Contact</a>
|
<a href="/contact/">Contact</a>
|
||||||
|
<a href="/login/">Login</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<a href="/about/">About</a>
|
<a href="/about/">About</a>
|
||||||
<a href="/blog/">Blog</a>
|
<a href="/blog/">Blog</a>
|
||||||
<a href="/contact/">Contact</a>
|
<a href="/contact/">Contact</a>
|
||||||
|
<a href="/login/">Login</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<a href="/about/">About</a>
|
<a href="/about/">About</a>
|
||||||
<a href="/blog/">Blog</a>
|
<a href="/blog/">Blog</a>
|
||||||
<a href="/contact/">Contact</a>
|
<a href="/contact/">Contact</a>
|
||||||
|
<a href="/login/">Login</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<a href="/about/">About</a>
|
<a href="/about/">About</a>
|
||||||
<a href="/blog/">Blog</a>
|
<a href="/blog/">Blog</a>
|
||||||
<a href="/contact/">Contact</a>
|
<a href="/contact/">Contact</a>
|
||||||
|
<a href="/login/">Login</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<a href="/about/">About</a>
|
<a href="/about/">About</a>
|
||||||
<a href="/blog/">Blog</a>
|
<a href="/blog/">Blog</a>
|
||||||
<a href="/contact/">Contact</a>
|
<a href="/contact/">Contact</a>
|
||||||
|
<a href="/login/">Login</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<a href="/about/">About</a>
|
<a href="/about/">About</a>
|
||||||
<a href="/blog/">Blog</a>
|
<a href="/blog/">Blog</a>
|
||||||
<a href="/contact/">Contact</a>
|
<a href="/contact/">Contact</a>
|
||||||
|
<a href="/login/">Login</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "Content-type: text/html"
|
echo "Content-type: text/html"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Extract token from query string
|
# Extract token from query string
|
||||||
TOKEN=$(echo "$QUERY_STRING" | sed -n 's/^.*token=\([^&]*\).*$/\1/p')
|
TOKEN=$(echo "$QUERY_STRING" | sed -n 's/^.*token=\([^&]*\).*$/\1/p')
|
||||||
|
|
||||||
# Check if the token exists and is valid (not expired)
|
# Check if the token exists and is valid (not expired)
|
||||||
DB_PATH="/var/lib/monotreme/data/monotreme.db"
|
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');")
|
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 <<EOF
|
cat <<EOF
|
||||||
<html>
|
<html>
|
||||||
<head><title>Invalid Token</title></head>
|
<head><title>Invalid Token</title></head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Invalid or expired token!</h1>
|
<h1>Invalid or expired token!</h1>
|
||||||
<a href="/login/forgot/">Request a new reset link</a>
|
<a href="/login/forgot/">Request a new reset link</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Display reset form
|
# Display reset form
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
<html>
|
<html>
|
||||||
<head><title>Reset Your Password</title></head>
|
<head><title>Reset Your Password</title></head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Reset Your Password</h1>
|
<h1>Reset Your Password</h1>
|
||||||
<form action="/cgi-bin/reset_password_confirm.cgi" method="post">
|
<form action="/cgi-bin/reset_password_confirm.cgi" method="post">
|
||||||
<input type="hidden" name="token" value="$TOKEN">
|
<input type="hidden" name="token" value="$TOKEN">
|
||||||
<label for="password">New Password:</label>
|
<label for="password">New Password:</label>
|
||||||
<input type="password" id="password" name="password" required>
|
<input type="password" id="password" name="password" required>
|
||||||
|
@ -38,7 +38,7 @@ cat <<EOF
|
||||||
<input type="password" id="confirm_password" name="confirm_password" required>
|
<input type="password" id="confirm_password" name="confirm_password" required>
|
||||||
<br>
|
<br>
|
||||||
<input type="submit" value="Reset Password">
|
<input type="submit" value="Reset Password">
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in a new issue