Skip to content

Commit

Permalink
Edited users.ts
Browse files Browse the repository at this point in the history
- Added an additional condition to the update User call to allow for new users to select their State upon account creation.
- If invitePending is true, a User can update their state regardless of their Region ID.
  • Loading branch information
hawkishpolicy committed Dec 20, 2024
1 parent 9f433bc commit 4d9ea65
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/src/api/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,9 @@ export const updateV2 = wrapHandler(async (event) => {
}

// Check if authorizer's region matches the user's
if (!matchesUserRegion(event, user.regionId)) return Unauthorized;
// Allows new users to select their state without a region on initial account creation
if (user.invitePending === false && !matchesUserRegion(event, user.regionId))
return Unauthorized;

if (body.state) {
body.regionId = REGION_STATE_MAP[body.state];
Expand Down

0 comments on commit 4d9ea65

Please sign in to comment.