mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 13:28:34 +00:00
update org selection error message
This commit is contained in:
@@ -354,9 +354,12 @@ export const authLoginServiceFactory = ({
|
|||||||
// Check if the user actually has access to the specified organization.
|
// Check if the user actually has access to the specified organization.
|
||||||
const userOrgs = await orgDAL.findAllOrgsByUserId(user.id);
|
const userOrgs = await orgDAL.findAllOrgsByUserId(user.id);
|
||||||
const hasOrganizationMembership = userOrgs.some((org) => org.id === organizationId);
|
const hasOrganizationMembership = userOrgs.some((org) => org.id === organizationId);
|
||||||
|
const selectedOrg = await orgDAL.findById(organizationId);
|
||||||
|
|
||||||
if (!hasOrganizationMembership) {
|
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);
|
await tokenDAL.incrementTokenSessionVersion(user.id, decodedToken.tokenVersionId);
|
||||||
|
|||||||
Reference in New Issue
Block a user