Skip to content

Commit

Permalink
Merge pull request #561 from OneCommunityGlobal/yihan-four-letter-code
Browse files Browse the repository at this point in the history
yihan hotfix for team code regex check
  • Loading branch information
one-community authored Oct 5, 2023
2 parents 9e3a2ab + b7201d5 commit 1ac5462
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/userProfileController.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ const userProfileController = function (UserProfile) {
return;
}

const teamcodeRegex = /^[a-zA-Z]-[a-zA-Z]{3}$/;
const teamcodeRegex = /^([a-zA-Z]-[a-zA-Z]{3}|[a-zA-Z]{5})$/;
if (!teamcodeRegex.test(req.body.teamCode)) {
res.status(400).send("The team code is invalid");
return;
Expand Down Expand Up @@ -608,7 +608,7 @@ const userProfileController = function (UserProfile) {
if (key === "teamCode") {
const canEditTeamCode = req.body.requestor.role === "Owner" ||
req.body.requestor.permissions?.frontPermissions.includes("editTeamCode");
const teamcodeRegex = /^[a-zA-Z]-[a-zA-Z]{3}$/;
const teamcodeRegex = /^([a-zA-Z]-[a-zA-Z]{3}|[a-zA-Z]{5})$/;

if(!canEditTeamCode){
res.status(403).send("You are not authorized to edit team code.");
Expand Down

0 comments on commit 1ac5462

Please sign in to comment.