diff --git a/src/models/climbing-route-rating/climbing_gyms/climbingGyms.router.ts b/src/models/climbing-route-rating/climbing_gyms/climbingGyms.router.ts index bc0404b..a2a0195 100644 --- a/src/models/climbing-route-rating/climbing_gyms/climbingGyms.router.ts +++ b/src/models/climbing-route-rating/climbing_gyms/climbingGyms.router.ts @@ -33,7 +33,7 @@ climbingGymRouter.post('/', async (req: Request, res: Response) => { try { let name = req.query.name as string; let city = req.query.city as string; - let captcha_token = req.query.captcha_token as string; + let captcha_token = req.query['h-captcha-response'] as string; if (!name || !city || !captcha_token) { res.status(400).send({'message': 'Missing parameters'}); diff --git a/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts b/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts index 3cd178d..17f0e3e 100644 --- a/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts +++ b/src/models/climbing-route-rating/climbing_routes/climbingRoutes.router.ts @@ -52,7 +52,7 @@ climbingRoutesRouter.post('/', async (req: Request, res: Response) => { let gym_id = Number(req.query.gym_id); let name = req.query.name as string; let difficulty = req.query.difficulty as string; - let captcha_token = req.query.captcha_token as string; + let captcha_token = req.query['h-captcha-response'] as string; if (isNaN(gym_id) || !name || !difficulty || !captcha_token) { res.status(400).send({'message': 'Missing parameters'}); diff --git a/src/models/climbing-route-rating/route_comments/routeComments.router.ts b/src/models/climbing-route-rating/route_comments/routeComments.router.ts index 075e4f7..8d34beb 100644 --- a/src/models/climbing-route-rating/route_comments/routeComments.router.ts +++ b/src/models/climbing-route-rating/route_comments/routeComments.router.ts @@ -29,7 +29,7 @@ routeCommentsRouter.post('/', async (req: Request, res: Response) => { try { let route_id = req.query.route_id as string; let comment = req.query.comment as string; - let captcha_token = req.query.captcha_token as string; + let captcha_token = req.query['h-captcha-response'] as string; if (!route_id || !comment || !captcha_token) { res.status(400).send({'message': 'Missing parameters'}); diff --git a/src/models/climbing-route-rating/route_ratings/routeRatings.router.ts b/src/models/climbing-route-rating/route_ratings/routeRatings.router.ts index 81fe1b3..fca29d9 100644 --- a/src/models/climbing-route-rating/route_ratings/routeRatings.router.ts +++ b/src/models/climbing-route-rating/route_ratings/routeRatings.router.ts @@ -2,6 +2,7 @@ import express, {Request, Response} from 'express'; import * as RatingService from './routeRatings.service'; import {Guid} from 'guid-typescript'; import logger from '../../../middleware/logger'; +import {verifyCaptcha} from '../common/VerifyCaptcha'; export const routeRatingsRouter = express.Router(); @@ -27,7 +28,7 @@ routeRatingsRouter.post('/', async (req: Request, res: Response) => { try { let route_id = req.query.route_id as string; let stars = Number(req.query.stars); - let captcha_token = req.query.captcha_token as string; + let captcha_token = req.query['h-captcha-response'] as string; if (!route_id || isNaN(stars) || !captcha_token) { console.log(route_id, stars, captcha_token); @@ -36,10 +37,10 @@ routeRatingsRouter.post('/', async (req: Request, res: Response) => { } // Verify captcha - /*if (!await verifyCaptcha(captcha_token)) { + if (!await verifyCaptcha(captcha_token)) { res.status(403).send({'message': 'Invalid Captcha. Please try again.'}); return; - }*/ + } let result = await RatingService.createRating(route_id, stars);