Success message changed for OTP verification
This commit is contained in:
parent
189c7bda82
commit
6c6179d2e7
@ -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
|
// Check OTP expiry
|
||||||
if (new Date() > new Date(user.login_otp_expires_at)) {
|
if (new Date() > new Date(user.login_otp_expires_at)) {
|
||||||
return res.status(400).json({
|
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
|
// Verify OTP
|
||||||
const isOtpValid = await bcrypt.compare(otp, user.login_otp);
|
const isOtpValid = await bcrypt.compare(otp, user.login_otp);
|
||||||
if (!isOtpValid) {
|
if (!isOtpValid) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user