Success message changed for OTP verification

This commit is contained in:
unknown 2025-12-31 17:32:22 +05:30
parent 189c7bda82
commit 6c6179d2e7

View File

@ -1155,13 +1155,6 @@ exports.verifyOTPForLogin = async (req, res) => {
});
}
if (!user.login_otp) {
return res.status(404).json({
status: "failed",
message: "Verification code not found or invalid user"
});
}
// Check OTP expiry
if (new Date() > new Date(user.login_otp_expires_at)) {
return res.status(400).json({
@ -1170,6 +1163,13 @@ exports.verifyOTPForLogin = async (req, res) => {
});
}
if (!user.login_otp) {
return res.status(404).json({
status: "failed",
message: "Verification code not found or invalid user"
});
}
// Verify OTP
const isOtpValid = await bcrypt.compare(otp, user.login_otp);
if (!isOtpValid) {