📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Catpcha timestamp calculation in ms
Blue Mouseb69ca06df834
diff --git a/backend/apps/production/src/captcha/captcha.controller.ts b/backend/apps/production/src/captcha/captcha.controller.tsindex e07a30eb8..362d01ae1 100644--- a/backend/apps/production/src/captcha/captcha.controller.ts+++ b/backend/apps/production/src/captcha/captcha.controller.ts@@ -64,7 +64,7 @@ export class CaptchaController {await this.captchaService.validatePIDForCAPTCHA(pid)- const timestamp = dayjs.utc().unix()+ const timestamp = dayjs.utc().unix() * 1000// For dummy (test) PIDsif (pid === DUMMY_PIDS.ALWAYS_PASS) {diff --git a/backend/apps/production/src/captcha/captcha.service.ts b/backend/apps/production/src/captcha/captcha.service.tsindex 135e0334e..3d44e7ef9 100644--- a/backend/apps/production/src/captcha/captcha.service.ts+++ b/backend/apps/production/src/captcha/captcha.service.ts@@ -171,7 +171,7 @@ export class CaptchaService {if (secretKey === DUMMY_SECRETS.ALWAYS_PASS) {return {hash: 'DUMMY_HASH00000111112222233333444445555566666777778888899999',- timestamp: dayjs().unix(),+ timestamp: dayjs().unix() * 1000,pid: DUMMY_PIDS.ALWAYS_PASS,}}@@ -183,7 +183,7 @@ export class CaptchaService {throw new BadRequestException('Could not decrypt token')}- if (dayjs().unix() - parsed.timestamp > CAPTCHA_TOKEN_LIFETIME) {+ if (dayjs().unix() * 1000 - parsed.timestamp > CAPTCHA_TOKEN_LIFETIME) {throw new BadRequestException('Token expired')}diff --git a/backend/apps/production/src/common/constants.ts b/backend/apps/production/src/common/constants.tsindex 1acb47686..227787df7 100644--- a/backend/apps/production/src/common/constants.ts+++ b/backend/apps/production/src/common/constants.ts@@ -79,7 +79,7 @@ const SEND_WARNING_AT_PERC = 85const PROJECT_INVITE_EXPIRE = 48-const CAPTCHA_TOKEN_LIFETIME = 300 // seconds (5 minutes).+const CAPTCHA_TOKEN_LIFETIME = 300 * 1000 // milliseconds (5 minutes).const CAPTCHA_SECRET_KEY_LENGTH = 50// Funnels