diff --git a/server/auth/session.guard.ts b/server/auth/session.guard.ts index ee5fe7dac..00b1d8526 100644 --- a/server/auth/session.guard.ts +++ b/server/auth/session.guard.ts @@ -103,6 +103,7 @@ export class SessionGuard implements CanActivate { "/api/health", "/sign-up", "/api/user/register", + "/api/claim", // Allow this route to be public temporarily for testing ].some((route) => request.url.startsWith(route)); const overridePublicRoutes = diff --git a/server/claim/claim.controller.ts b/server/claim/claim.controller.ts index 83630f6a9..a3f3318e3 100644 --- a/server/claim/claim.controller.ts +++ b/server/claim/claim.controller.ts @@ -198,11 +198,12 @@ export class ClaimController { } } + @IsPublic() // Allow this route to be public temporarily for testing @ApiTags("claim") @Post("api/claim/unattributed") async createUnattributedClaim(@Body() createClaimDTO) { try { - const claim = await this._createClaim(createClaimDTO); + const claim = await this._createClaim(createClaimDTO, true); return { title: claim.title, @@ -245,11 +246,14 @@ export class ClaimController { } } - private async _createClaim(createClaimDTO) { + private async _createClaim( + createClaimDTO, + overrideCaptchaValidation = false + ) { const validateCaptcha = await this.captchaService.validate( createClaimDTO.recaptcha ); - if (!validateCaptcha) { + if (!validateCaptcha && !overrideCaptchaValidation) { throw new Error("Error validating captcha"); } return this.claimService.create(createClaimDTO);