CRR: Fixing captcha http parameter
All checks were successful
Jenkins Production Deployment

This commit is contained in:
Patrick Müller 2022-01-09 15:12:34 +01:00
parent 25a66b060c
commit e98d1d48ab
Signed by: Paddy
GPG Key ID: 37ABC11275CAABCE
4 changed files with 7 additions and 6 deletions

View File

@ -33,7 +33,7 @@ climbingGymRouter.post('/', async (req: Request, res: Response) => {
try { try {
let name = req.query.name as string; let name = req.query.name as string;
let city = req.query.city 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) { if (!name || !city || !captcha_token) {
res.status(400).send({'message': 'Missing parameters'}); res.status(400).send({'message': 'Missing parameters'});

View File

@ -52,7 +52,7 @@ climbingRoutesRouter.post('/', async (req: Request, res: Response) => {
let gym_id = Number(req.query.gym_id); let gym_id = Number(req.query.gym_id);
let name = req.query.name as string; let name = req.query.name as string;
let difficulty = req.query.difficulty 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) { if (isNaN(gym_id) || !name || !difficulty || !captcha_token) {
res.status(400).send({'message': 'Missing parameters'}); res.status(400).send({'message': 'Missing parameters'});

View File

@ -29,7 +29,7 @@ routeCommentsRouter.post('/', async (req: Request, res: Response) => {
try { try {
let route_id = req.query.route_id as string; let route_id = req.query.route_id as string;
let comment = req.query.comment 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) { if (!route_id || !comment || !captcha_token) {
res.status(400).send({'message': 'Missing parameters'}); res.status(400).send({'message': 'Missing parameters'});

View File

@ -2,6 +2,7 @@ import express, {Request, Response} from 'express';
import * as RatingService from './routeRatings.service'; import * as RatingService from './routeRatings.service';
import {Guid} from 'guid-typescript'; import {Guid} from 'guid-typescript';
import logger from '../../../middleware/logger'; import logger from '../../../middleware/logger';
import {verifyCaptcha} from '../common/VerifyCaptcha';
export const routeRatingsRouter = express.Router(); export const routeRatingsRouter = express.Router();
@ -27,7 +28,7 @@ routeRatingsRouter.post('/', async (req: Request, res: Response) => {
try { try {
let route_id = req.query.route_id as string; let route_id = req.query.route_id as string;
let stars = Number(req.query.stars); 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) { if (!route_id || isNaN(stars) || !captcha_token) {
console.log(route_id, stars, captcha_token); console.log(route_id, stars, captcha_token);
@ -36,10 +37,10 @@ routeRatingsRouter.post('/', async (req: Request, res: Response) => {
} }
// Verify captcha // Verify captcha
/*if (!await verifyCaptcha(captcha_token)) { if (!await verifyCaptcha(captcha_token)) {
res.status(403).send({'message': 'Invalid Captcha. Please try again.'}); res.status(403).send({'message': 'Invalid Captcha. Please try again.'});
return; return;
}*/ }
let result = await RatingService.createRating(route_id, stars); let result = await RatingService.createRating(route_id, stars);