Changed register api route and added user deletion route
This commit is contained in:
parent
d889432ce8
commit
588f3bae89
|
@ -223,7 +223,7 @@ fastify.get('/api/:shortcode', async (req, res) => {
|
|||
|
||||
|
||||
//User registration
|
||||
fastify.post('/api/register', async (req, res) => {
|
||||
fastify.post('/api/auth/register', async (req, res) => {
|
||||
if (!config.registrationEnabled) {
|
||||
res.statusCode = 400;
|
||||
return "Registration was disabled by your admin";
|
||||
|
@ -347,6 +347,14 @@ fastify.after(() => {
|
|||
return "Done!";
|
||||
});
|
||||
|
||||
fastify.post('/api/auth/deleteme', { onRequest: fastify.auth([fastify.basicAuth, fastify.verifyJWT]) }, async (req, reply) => {
|
||||
await knex('users')
|
||||
.where('username', '=', req.user)
|
||||
.delete();
|
||||
|
||||
return "Done!";
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue