This commit is contained in:
parent
924d16a1a4
commit
9c234e6994
|
@ -127,7 +127,8 @@ climbingGymRouter.post('/', async (req: Request, res: Response) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify captcha
|
// Verify captcha
|
||||||
if (!await verifyCaptcha(captcha_token)) {
|
let success = await verifyCaptcha(captcha_token);
|
||||||
|
if (!success) {
|
||||||
res.status(403).send({'message': 'Invalid Captcha. Please try again.'});
|
res.status(403).send({'message': 'Invalid Captcha. Please try again.'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ export const createGym = async (name: string, city: string): Promise<number> =>
|
||||||
try {
|
try {
|
||||||
let res = await conn.query('INSERT INTO climbing_gyms (name, city) VALUES (?, ?) RETURNING gym_id', [name, city]);
|
let res = await conn.query('INSERT INTO climbing_gyms (name, city) VALUES (?, ?) RETURNING gym_id', [name, city]);
|
||||||
|
|
||||||
return res[0].hall_id;
|
return res[0].gym_id;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,6 @@ export const verifyCaptcha = async (captcha_token: string): Promise<boolean> =>
|
||||||
secret: process.env.HCAPTCHA_SECRET
|
secret: process.env.HCAPTCHA_SECRET
|
||||||
});
|
});
|
||||||
|
|
||||||
axios.post('https://hcaptcha.com/siteverify', postData)
|
let res = await axios.post('https://hcaptcha.com/siteverify', postData);
|
||||||
.then(res => {
|
return res.data.success;
|
||||||
return res.data.success;
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
throw(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user