add: is_approve null, validate is_approve login

This commit is contained in:
2025-10-08 11:36:39 +07:00
parent 58cb0c8425
commit b16e65463d

View File

@@ -25,7 +25,10 @@ class AuthService {
user_password: hashedPassword,
role_id: null,
is_sa: 0,
is_active: 1
is_active: 1,
is_approve: 0,
approved_by: null,
approved_at: null
});
const newUser = {
@@ -58,6 +61,10 @@ class AuthService {
throw new ErrorHandler(403, 'User is inactive');
}
if (!user.is_approve) {
throw new ErrorHandler(403, 'Your account has not been approved by admin yet.');
}
const payload = {
user_id: user.user_id,
user_fullname: user.user_fullname,