blob: 6cdd97ab47fc740ad5b51578f46a659d3b5e9095 [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)
pineafanf97734b2021-11-23 21:11:00 +000011
pineafanc540da92021-09-03 20:33:36 +010012 let secret = "slwu0rZV5W6WdmGtgI16du8Ar2tQGMr3Q9dE6u3poKiVODNV9SweaA3buawgkTmTuITXDWOUpBcTFA0qWrUvoshi1JB180WOFwA7"
13 let resp = await Axios.get(
pineafan45803122022-05-06 21:33:30 +010014 `http://localhost:10000/verify/${req.body.gid}/${req.body.rid}/${req.body.uid}/${secret}/${req.body.code}`
pineafan4819ece2021-09-04 10:10:29 +010015 )
pineafanc540da92021-09-03 20:33:36 +010016 return res.send(resp.status);
17}
pineafanaed30242021-09-04 09:33:40 +010018
19export default Complete;