blob: 62802baf0b51e1fc71694a7ecda5237ffcbe5e5d [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 {
TheCodedProff054b8c2023-03-03 15:32:19 -050014 await Axios.post(`${process.env.NUCLEUS_CALLBACK}/verify/${req.body.code}`, {
pineafan83152e22022-06-13 17:52:55 +010015 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;