Improve error handling and feedback for password reset functionality

This commit is contained in:
2026-09-10 12:49:37 +02:00
parent 130a43eabc
commit ffc824f27c
2 changed files with 14 additions and 5 deletions
+13 -4
View File
@@ -53,13 +53,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Verstuur herstelmail via de nieuwe FocizMailer // Verstuur herstelmail via de nieuwe FocizMailer
$mailResult = FocizMailer::sendPasswordResetEmail($user['email'], $user['name'], $resetUrl); $mailResult = FocizMailer::sendPasswordResetEmail($user['email'], $user['name'], $resetUrl);
if (!$mailResult['success']) { if (!$mailResult['success']) {
error_log("Fout bij verzenden wachtwoordherstel mail naar {$email}: " . ($mailResult['error'] ?? 'Onbekend')); $errMsg = $mailResult['error'] ?? 'Mailserver fout';
error_log("Fout bij verzenden wachtwoordherstel mail naar {$email}: {$errMsg}");
$error = "De herstelmail kon niet worden verzonden via de mailserver: " . htmlspecialchars($errMsg);
} else {
$submitted = true;
}
} else {
// In development omgeving geven we directe diagnostische feedback
if (defined('APP_ENV') && APP_ENV === 'development') {
$error = "Er is geen Fociz account gevonden met het e-mailadres '{$email}'. Controleer of dit e-mailadres correct is ingevoerd.";
} else {
// Anti-enumeratie op productie: toon altijd succes
$submitted = true;
} }
} }
// Anti-enumeratie: Toon altijd succes ongeacht of het e-mailadres bestaat
$submitted = true;
} catch (Throwable $e) { } catch (Throwable $e) {
error_log("Wachtwoord vergeten fout: " . $e->getMessage()); error_log("Wachtwoord vergeten fout: " . $e->getMessage());
$error = "Er is een technische fout opgetreden. Probeer het over enkele ogenblikken opnieuw."; $error = "Er is een technische fout opgetreden. Probeer het over enkele ogenblikken opnieuw.";
+1 -1
View File
@@ -136,7 +136,7 @@ define('SMTP_PORT', (int)fociz_env('SMTP_PORT', 587));
define('SMTP_USER', fociz_env('SMTP_USER', 'info@fociz.nl')); define('SMTP_USER', fociz_env('SMTP_USER', 'info@fociz.nl'));
define('SMTP_PASS', fociz_env('SMTP_PASS', '6swpQSBg5uWFmjar7F6a')); define('SMTP_PASS', fociz_env('SMTP_PASS', '6swpQSBg5uWFmjar7F6a'));
define('SMTP_SECURE', fociz_env('SMTP_SECURE', 'tls')); // 'tls' (STARTTLS port 587) of 'ssl' (port 465) define('SMTP_SECURE', fociz_env('SMTP_SECURE', 'tls')); // 'tls' (STARTTLS port 587) of 'ssl' (port 465)
define('SMTP_FROM_EMAIL', fociz_env('SMTP_FROM_EMAIL', 'no-reply@fociz.nl')); define('SMTP_FROM_EMAIL', fociz_env('SMTP_FROM_EMAIL', 'info@fociz.nl'));
define('SMTP_FROM_NAME', fociz_env('SMTP_FROM_NAME', 'Fociz')); define('SMTP_FROM_NAME', fociz_env('SMTP_FROM_NAME', 'Fociz'));
define('SMTP_REPLY_TO', fociz_env('SMTP_REPLY_TO', 'info@fociz.nl')); define('SMTP_REPLY_TO', fociz_env('SMTP_REPLY_TO', 'info@fociz.nl'));