This commit is contained in:
2020-05-05 23:07:00 -04:00
parent f2309463a4
commit 4d51a4ac9e
26 changed files with 476 additions and 189 deletions

View File

@@ -29,14 +29,15 @@ router.all('/logout', async function(req, res, next){
}
});
router.post('/invite/:token', async function(req, res, next) {
router.post('/invite/:token/:mailToken', async function(req, res, next) {
try{
req.body.token = req.params.token;
req.body.mailToken = req.params.mailToken;
let user = await User.addByInvite(req.body);
let token = await AuthToken.add(user);
return res.json({
user: user.username,
user: user.uid,
token: token.token
});
@@ -46,6 +47,21 @@ router.post('/invite/:token', async function(req, res, next) {
});
router.post('/invite/:token', async function(req, res, next){
try{
let data = {
token: req.params.token,
url: `${req.protocol}://${req.hostname}`,
mail: req.body.mail,
}
await User.verifyEmail(data);
return res.send({message: 'sent'});
}catch(error){
next(error)
}
});
module.exports = router;
/*