MFA
This commit is contained in:
@@ -345,6 +345,31 @@ const validateCoordinatesBody = [
|
||||
.withMessage("Longitude must be between -180 and 180"),
|
||||
];
|
||||
|
||||
// Two-Factor Authentication validation
|
||||
const validateTotpCode = [
|
||||
body("code")
|
||||
.trim()
|
||||
.matches(/^\d{6}$/)
|
||||
.withMessage("TOTP code must be exactly 6 digits"),
|
||||
handleValidationErrors,
|
||||
];
|
||||
|
||||
const validateEmailOtp = [
|
||||
body("code")
|
||||
.trim()
|
||||
.matches(/^\d{6}$/)
|
||||
.withMessage("Email OTP must be exactly 6 digits"),
|
||||
handleValidationErrors,
|
||||
];
|
||||
|
||||
const validateRecoveryCode = [
|
||||
body("code")
|
||||
.trim()
|
||||
.matches(/^[A-Za-z0-9]{4}-[A-Za-z0-9]{4}$/i)
|
||||
.withMessage("Recovery code must be in format XXXX-XXXX"),
|
||||
handleValidationErrors,
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
sanitizeInput,
|
||||
handleValidationErrors,
|
||||
@@ -359,4 +384,8 @@ module.exports = {
|
||||
validateFeedback,
|
||||
validateCoordinatesQuery,
|
||||
validateCoordinatesBody,
|
||||
// Two-Factor Authentication
|
||||
validateTotpCode,
|
||||
validateEmailOtp,
|
||||
validateRecoveryCode,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user