Skip to content

Commit f7a2a22

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

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,15 @@ 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({
207+
overrideCaptchaValidation: true,
208+
...createClaimDTO,
209+
});
206210

207211
return {
208212
title: claim.title,
@@ -246,10 +250,11 @@ export class ClaimController {
246250
}
247251

248252
private async _createClaim(createClaimDTO) {
253+
const { overrideCaptchaValidation = false } = createClaimDTO;
249254
const validateCaptcha = await this.captchaService.validate(
250255
createClaimDTO.recaptcha
251256
);
252-
if (!validateCaptcha) {
257+
if (!validateCaptcha && !overrideCaptchaValidation) {
253258
throw new Error("Error validating captcha");
254259
}
255260
return this.claimService.create(createClaimDTO);

0 commit comments

Comments
 (0)