diff options
Diffstat (limited to 'src/api')
-rw-r--r-- | src/api/routes/auth/generate-registration-tokens.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/api/routes/auth/generate-registration-tokens.ts b/src/api/routes/auth/generate-registration-tokens.ts index 0d4cf067..ba40bd9a 100644 --- a/src/api/routes/auth/generate-registration-tokens.ts +++ b/src/api/routes/auth/generate-registration-tokens.ts @@ -33,9 +33,17 @@ router.get( transaction: false, }); - if (req.query.plain) - return res.send(tokens.map((x) => x.token).join("\n")); + const ret = req.query.include_url + ? tokens.map( + (x) => + `${Config.get().general.frontPage}/register?token=${ + x.token + }`, + ) + : tokens.map((x) => x.token); - return res.json({ tokens: tokens.map((x) => x.token) }); + if (req.query.plain) return res.send(ret.join("\n")); + + return res.json({ tokens: ret }); }, ); |