blob: 39bd55c9dfc1edba784f5420b92c1b26c90a5ff3 [file] [log] [blame]
pineafanfd93e6e2022-05-06 20:30:09 +01001import Axios from 'axios';
2import qs from 'querystring';
3
4const Complete = async (req, res) => {
pineafanaa9c4fd2022-06-10 19:58:10 +01005 const chk = await Axios.post('https://hcaptcha.com/siteverify', qs.stringify({
6 response: req.body.tkn,
7 secret: '0x19C699BFfce07b2a026121DE6702706BB2d51D6c',
8 sitekey: '85074411-fa13-4d9b-b901-53095c6d1fc6'
pineafanfd93e6e2022-05-06 20:30:09 +01009 }))
10 if ( !chk.data.success ) {
11 return res.status(200).send({success: false})
12 }
pineafanaa9c4fd2022-06-10 19:58:10 +010013 let secret = process.env.VERIFY_SECRET
pineafanfd93e6e2022-05-06 20:30:09 +010014 try {
15 await Axios.post(`http://192.168.0.18:10000/verify/${req.body.code}`, {
16 secret: secret
17 });
18 } catch (e) {
19 return res.status(200).send({success: false})
20 }
21 return res.status(200).send({success: true});
22}
23
24export default Complete;