debug server error

This commit is contained in:
Thanakorn S
2026-05-13 16:19:04 +07:00
parent 4433ef184e
commit 47ccd7585b
+43 -42
View File
@@ -140,36 +140,37 @@ 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]); $mail_sent = $mailer->send_email([
$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", [
"Hi {$r['name']},", "Hi {$r['name']},",
"", "",
"You attempted to login but your email is not yet verified.", "You attempted to login but your email is not yet verified.",
"Please verify your email address by clicking the button below:", "Please verify your email address by clicking the button below:",
"", "",
"<a href='{$verify_url}' style='display:inline-block;padding:12px 28px;background:#E66239;color:#ffffff;text-decoration:none;border-radius:6px;font-weight:600;'>Verify Email Address</a>", "<a href='{$verify_url}' style='display:inline-block;padding:12px 28px;background:#E66239;color:#ffffff;text-decoration:none;border-radius:6px;font-weight:600;'>Verify Email Address</a>",
"", "",
"Or copy and paste this link into your browser:", "Or copy and paste this link into your browser:",
"<a href='{$verify_url}'>{$verify_url}</a>", "<a href='{$verify_url}'>{$verify_url}</a>",
"", "",
"This link will expire in 30 days.", "This link will expire in 30 days.",
]), ]),
'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());
}
$answer["message"] = "Your email is not verified. We've sent a new verification link to your inbox — please check your email."; if ($mail_sent) {
$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