From 620a423cee4163b98d7ba66ca6ee64d74a34a0c9 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Mon, 24 Jun 2024 13:43:36 -0400 Subject: [PATCH] update org selection error message --- backend/src/services/auth/auth-login-service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.ts index dacafa0e2..8090b937a 100644 --- a/backend/src/services/auth/auth-login-service.ts +++ b/backend/src/services/auth/auth-login-service.ts @@ -354,9 +354,12 @@ export const authLoginServiceFactory = ({ // Check if the user actually has access to the specified organization. const userOrgs = await orgDAL.findAllOrgsByUserId(user.id); const hasOrganizationMembership = userOrgs.some((org) => org.id === organizationId); + const selectedOrg = await orgDAL.findById(organizationId); if (!hasOrganizationMembership) { - throw new UnauthorizedError({ message: "User does not have access to the organization" }); + throw new UnauthorizedError({ + message: `User does not have access to the organization named ${selectedOrg?.name}` + }); } await tokenDAL.incrementTokenSessionVersion(user.id, decodedToken.tokenVersionId);