add: more things

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-06 15:21:55 +08:00
parent 7ba03ad4db
commit 095a0d4b3c
15 changed files with 756 additions and 211 deletions
+22 -2
View File
@@ -6,9 +6,12 @@
* - loginValidator → POST /auth/login
* - verifyOTPValidator → POST /auth/verify-otp
* - resendOTPValidator → POST /auth/resend-otp
* - changePassValidator → POST /auth/change-password
* - changePassValidator → POST /auth/change-password
* - forgotPasswordValidator → POST /auth/forgot-password
* - resetPasswordValidator → POST /auth/reset-password
* Author: rgrgogu
* Date Created: Oct. 6, 2025
* Date Modified: Jul. 4, 2026 — forgot/reset password (Kenneth Obsequio)
***********************************************************************************************************************************************************************/
const { body } = require('express-validator');
@@ -43,4 +46,21 @@ const changePassValidator = [
.matches(/[0-9]/).withMessage('Must contain a number.'),
];
module.exports = { registerValidator, loginValidator, verifyOTPValidator, resendOTPValidator, changePassValidator };
const forgotPasswordValidator = [
body('email').isEmail().withMessage('Valid email is required.'),
];
const resetPasswordValidator = [
body('email').isEmail().withMessage('Valid email is required.'),
body('otp').isLength({ min: 6, max: 6 }).isNumeric().withMessage('OTP must be 6 digits.'),
body('new_password')
.isLength({ min: 8 }).withMessage('New password must be at least 8 characters.')
.matches(/[A-Z]/).withMessage('Must contain an uppercase letter.')
.matches(/[0-9]/).withMessage('Must contain a number.'),
];
module.exports = {
registerValidator, loginValidator,
verifyOTPValidator, resendOTPValidator, changePassValidator,
forgotPasswordValidator, resetPasswordValidator,
};