From b16e65463d9074b42e87122c358a4436409d722e Mon Sep 17 00:00:00 2001 From: Antony Kurniawan Date: Wed, 8 Oct 2025 11:36:39 +0700 Subject: [PATCH] add: is_approve null, validate is_approve login --- services/auth.service.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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,