blob: 8a0ce3255f2aa2df1c7c172ef34a80f948735ff1 [file] [log] [blame]
pineafanc540da92021-09-03 20:33:36 +01001import Axios from 'axios';
2
pineafanaed30242021-09-04 09:33:40 +01003const Complete = async (req, res) => {
pineafan45803122022-05-06 21:33:30 +01004 let code = await Axios.post('http://127.0.0.1:3000/api/rsmv/validate', {code:req.body.code});
pineafan9babd752022-10-21 21:47:52 +01005 if (code.status !== 200) {
pineafanc540da92021-09-03 20:33:36 +01006 return res.send(404);
7 }
pineafan9babd752022-10-21 21:47:52 +01008 if (code.data.user !== req.body.uid) return res.send(401)
9 if (code.data.guild !== req.body.gid) return res.send(401)
10 if (code.data.role !== req.body.rid) return res.send(401)
TheCodedProf1713ed52023-03-01 15:53:31 -050011 console.log(req.body)
pineafanf97734b2021-11-23 21:11:00 +000012
pineafan4d151ef2022-10-28 21:55:56 +010013 let secret = process.env.VERIFY_SECRET;
pineafanc540da92021-09-03 20:33:36 +010014 let resp = await Axios.get(
TheCodedProf1713ed52023-03-01 15:53:31 -050015 `http://127.0.0.1:10000/verify/${req.body.gid}/${req.body.rid}/${req.body.uid}/${secret}/${req.body.code}`
pineafan4819ece2021-09-04 10:10:29 +010016 )
pineafanc540da92021-09-03 20:33:36 +010017 return res.send(resp.status);
18}
pineafanaed30242021-09-04 09:33:40 +010019
20export default Complete;