Back to Sign In

Forgot Password?

No worries! Enter your email address and we'll send you a link to reset your password.

For your security, we will only send the reset link to the email address associated with your HustleGride account.
Remember your password?
session_start(); require_once 'config/database.php'; $error_message = ''; $success_message = ''; // Check if user is already logged in if (isset($_SESSION['user_id'])) { header("Location: dashboard.php"); exit(); } // Handle forgot password form submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { $email = sanitizeInput($_POST['email']); if (empty($email)) { $error_message = 'Please enter your email address.'; } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error_message = 'Please enter a valid email address.'; } else { $connection = getDBConnection(); // Check if email exists $sql = "SELECT user_id, username, first_name FROM users WHERE email = ? AND status = 'active'"; $stmt = $connection->prepare($sql); $stmt->bind_param("s", $email); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 1) { $user = $result->fetch_assoc(); // Generate password reset token $token = bin2hex(random_bytes(32)); $expires = date('Y-m-d H:i:s', strtotime('+1 hour')); // Store the token in database (you would need to create a password_resets table) // For this demo, we'll simulate the process // In a real application, you would: // 1. Store the token in a password_resets table // 2. Send an email with the reset link // 3. Create a reset-password.php page to handle the token // Log the activity $activity_sql = "INSERT INTO activity_log (user_id, activity_type, description, ip_address) VALUES (?, 'password_reset_request', 'Password reset requested', ?)"; $activity_stmt = $connection->prepare($activity_sql); $ip_address = $_SERVER['REMOTE_ADDR']; $activity_stmt->bind_param("is", $user['user_id'], $ip_address); $activity_stmt->execute(); $success_message = 'If an account with that email exists, we have sent you a password reset link.'; $activity_stmt->close(); } else { // Don't reveal if email exists or not for security $success_message = 'If an account with that email exists, we have sent you a password reset link.'; } $stmt->close(); closeDBConnection($connection); } } ?> Forgot Password - HustleGride
Back to Sign In

Forgot Password?

No worries! Enter your email address and we'll send you a link to reset your password.

For your security, we will only send the reset link to the email address associated with your HustleGride account.
Remember your password?