#!/bin/bash echo "Content-type: text/html" echo "" # Extract token from query string TOKEN=$(echo "$QUERY_STRING" | sed -n 's/^.*token=\([^&]*\).*$/\1/p') # 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 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