debug server error

This commit is contained in:
Thanakorn S
2026-05-13 16:19:04 +07:00
parent 4433ef184e
commit 47ccd7585b
+20 -19
View File
@@ -140,12 +140,12 @@ if (password_verify(trim($data["password"]), $temp["password"])) {
. '://' . $_SERVER['HTTP_HOST'] . rtrim($server_url, '/'); . '://' . $_SERVER['HTTP_HOST'] . rtrim($server_url, '/');
$verify_url = $base_url . '/login/verify.php?token=' . $token; $verify_url = $base_url . '/login/verify.php?token=' . $token;
try {
require_once $include_url . 'assets/utils/module/mailer.php'; require_once $include_url . 'assets/utils/module/mailer.php';
$mailer = new mailer(['pdo1' => $pdo1]); $mailer = new mailer(['pdo1' => $pdo1]);
$mailer->send_email([ $mail_sent = $mailer->send_email([
'company_id' => 0, 'company_id' => 0,
'smtp' => $SMTP, 'smtp' => $SMTP,
'silent' => true,
'to' => $r['email'], 'to' => $r['email'],
'subject' => 'Verify your email — WMS', 'subject' => 'Verify your email — WMS',
'message' => implode("\n", [ 'message' => implode("\n", [
@@ -164,12 +164,13 @@ if (password_verify(trim($data["password"]), $temp["password"])) {
'channel_name' => 'WMS', 'channel_name' => 'WMS',
'key' => $pinkey, 'key' => $pinkey,
]); ]);
} catch (Exception $e) {
// Log silently — do not expose mailer errors to the end user
error_log('[resend_verify] ' . $e->getMessage());
}
if ($mail_sent) {
$answer["message"] = "Your email is not verified. We've sent a new verification link to your inbox — please check your email."; $answer["message"] = "Your email is not verified. We've sent a new verification link to your inbox — please check your email.";
} else {
$answer["message"] = "Your email is not verified. Verification email could not be sent — please contact your administrator.";
$answer["verify_url"] = $verify_url;
}
exit(json_encode($answer)); exit(json_encode($answer));
} }
@@ -306,22 +307,22 @@ if (password_verify(trim($data["password"]), $temp["password"])) {
} }
} }
if (!empty($smtp_config)) { // if (!empty($smtp_config)) {
require "../../../assets/utils/module/mailer.php"; // require "../../../assets/utils/module/mailer.php";
$mailer = new mailer(["pdo1" => $pdo1, "pdo2" => $pdo2]); // $mailer = new mailer(["pdo1" => $pdo1, "pdo2" => $pdo2]);
$mailer->send_email([ // $mailer->send_email([
"company_id" => $default_company, // "company_id" => $default_company,
"smtp" => $smtp_config, // "smtp" => $smtp_config,
"subject" => "One Time Password (OTP) For reference number " . $reference_number, // "subject" => "One Time Password (OTP) For reference number " . $reference_number,
"message" => "Your OTP is " . $otp . " for reference number " . $reference_number, // "message" => "Your OTP is " . $otp . " for reference number " . $reference_number,
"channel_name" => "WMS LOGIN OTP", // "channel_name" => "WMS LOGIN OTP",
"to" => $user_email, // "to" => $user_email,
"key" => $pinkey, // "key" => $pinkey,
]); // ]);
} // }
// ── Step 9: Reset session and write OTP state ───────────────────────────── // ── Step 9: Reset session and write OTP state ─────────────────────────────
// The full session is cleared first to prevent session fixation — any data // The full session is cleared first to prevent session fixation — any data