#!/bin/bash
echo "Content-type: text/html"
echo ""
# Log the raw POST data for debugging
read POST_DATA
# Parse the form data
TOKEN=""
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
token) TOKEN="$value" ;;
password) PASSWORD="$value" ;;
confirm_password) CONFIRM_PASSWORD="$value" ;;
esac
done
# Check if passwords match
if [ "$PASSWORD" != "$CONFIRM_PASSWORD" ]; then
cat <
Password Reset Failed
Passwords do not match!
Try again