diff --git a/services/auth.service.js b/services/auth.service.js index 97deb43..dde32a8 100644 --- a/services/auth.service.js +++ b/services/auth.service.js @@ -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,