Skip to content

Commit 2e7a130

Browse files
committed
Temporarily allow claim creation endpoint to be used for testing publicly
1 parent 059b0ea commit 2e7a130

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

server/auth/session.guard.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export class SessionGuard implements CanActivate {
103103
"/api/health",
104104
"/sign-up",
105105
"/api/user/register",
106+
"/api/claim", // Allow this route to be public temporarily for testing
106107
].some((route) => request.url.startsWith(route));
107108

108109
const overridePublicRoutes =

server/claim/claim.controller.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,12 @@ export class ClaimController {
198198
}
199199
}
200200

201+
@IsPublic() // Allow this route to be public temporarily for testing
201202
@ApiTags("claim")
202203
@Post("api/claim/unattributed")
203204
async createUnattributedClaim(@Body() createClaimDTO) {
204205
try {
205-
const claim = await this._createClaim(createClaimDTO);
206+
const claim = await this._createClaim(createClaimDTO, true);
206207

207208
return {
208209
title: claim.title,
@@ -245,11 +246,14 @@ export class ClaimController {
245246
}
246247
}
247248

248-
private async _createClaim(createClaimDTO) {
249+
private async _createClaim(
250+
createClaimDTO,
251+
overrideCaptchaValidation = false
252+
) {
249253
const validateCaptcha = await this.captchaService.validate(
250254
createClaimDTO.recaptcha
251255
);
252-
if (!validateCaptcha) {
256+
if (!validateCaptcha && !overrideCaptchaValidation) {
253257
throw new Error("Error validating captcha");
254258
}
255259
return this.claimService.create(createClaimDTO);

0 commit comments

Comments
 (0)