blob: cdffc2e2312765095e079a02486d80bd4c424638 [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 }
pineafanfd93e6e2022-05-06 20:30:09 +010013 try {
pineafan83152e22022-06-13 17:52:55 +010014 await Axios.post(`${process.env.VERIFY_CALLBACK}/verify/${req.body.code}`, {
15 secret: process.env.VERIFY_SECRET
pineafanfd93e6e2022-05-06 20:30:09 +010016 });
17 } catch (e) {
18 return res.status(200).send({success: false})
19 }
20 return res.status(200).send({success: true});
21}
22
23export default Complete;