From 32a7fe219e2b4335df864c268d6b2abbad2c80f2 Mon Sep 17 00:00:00 2001 From: avicenan Date: Wed, 15 Apr 2026 11:30:23 +0700 Subject: [PATCH] fix(auth): throw error on login --- src/controllers/auth.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controllers/auth.ts b/src/controllers/auth.ts index bdf6549..c0bec5e 100644 --- a/src/controllers/auth.ts +++ b/src/controllers/auth.ts @@ -53,7 +53,7 @@ export class AuthController { }) if (!user) { - return ReturnHelper.errorResponse(res, 401, 401, Language.lang.failed_access + ", username or password is incorrect") + return ReturnHelper.errorResponse(res, 401, 401, Language.lang.failed_access, "Username or password is incorrect") } if (user != null && user.roles != null && user.roles.length > 0 && user.checkIfPasswordMatch(param.password)) { @@ -86,7 +86,7 @@ export class AuthController { } if (role_id == "") { - return ReturnHelper.errorResponse(res, 403, 403, Language.lang.failed_access + ", you don't have any roles in this application") + return ReturnHelper.errorResponse(res, 403, 403, Language.lang.failed_access, "You don't have any roles in this application") } else { // const userRole = await userRoleRepository.findOneBy({ id: role_id }) var hrms = { @@ -150,9 +150,9 @@ export class AuthController { } if (user.roles == null || user.roles.length == 0) { - return ReturnHelper.errorResponse(res, 401, 401, Language.lang.failed_access + ", you don't have any roles in this application") + return ReturnHelper.errorResponse(res, 401, 401, Language.lang.failed_access, "You don't have any roles in this application") } else { - return ReturnHelper.errorResponse(res, 401, 401, Language.lang.failed_access + ", username or password is incorrect") + return ReturnHelper.errorResponse(res, 401, 401, Language.lang.failed_access, "Username or password is incorrect") } } catch (e: unknown) { log.error(e)