Improve error handling and feedback for password reset functionality
This commit is contained in:
@@ -53,13 +53,22 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// Verstuur herstelmail via de nieuwe FocizMailer
|
||||
$mailResult = FocizMailer::sendPasswordResetEmail($user['email'], $user['name'], $resetUrl);
|
||||
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) {
|
||||
error_log("Wachtwoord vergeten fout: " . $e->getMessage());
|
||||
$error = "Er is een technische fout opgetreden. Probeer het over enkele ogenblikken opnieuw.";
|
||||
|
||||
+1
-1
@@ -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_PASS', fociz_env('SMTP_PASS', '6swpQSBg5uWFmjar7F6a'));
|
||||
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_REPLY_TO', fociz_env('SMTP_REPLY_TO', 'info@fociz.nl'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user