A separate session is started when I use token launched forgot password form to reset password. How can I codify
reseturl to use active session only?
public function sendToken($email, $resetUrl) {
// Validate email address
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
return false; // Invalid email address
}
// Output or log the value of the reset URL
echo "Reset URL: $resetUrl"; // Output to screen
// Encode HTML content
$emailBody = '<br><br>To reset your password, click <a href="' . $resetUrl . '" target="_self">here</a>.';
// Set additional headers
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=UTF-8rn";
$headers .= "From: Your Name <[email protected]>rn";
$headers .= "Reply-To: Your Name <[email protected]>rn";
$headers .= "X-Mailer: PHP/" . phpversion();
// Send email
$subject = 'Reset your password';
if (mail($email, $subject, $emailBody, $headers)) {
return true; // Email sent successfully
}
return false; // Failed to send email
} I tried above code but url form uses a seperate session and I cannot update my user database. I have user Authentication using Session for security.