From e55b380bb4148ba0e3297e81d95536b800307c06 Mon Sep 17 00:00:00 2001 From: Peter KW Date: Tue, 19 Mar 2024 00:14:55 +0100 Subject: [PATCH] Should be able to delete users except for self now --- backend/internal/handlers/handlers_user_related.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/internal/handlers/handlers_user_related.go b/backend/internal/handlers/handlers_user_related.go index 0619ea5..194f5d5 100644 --- a/backend/internal/handlers/handlers_user_related.go +++ b/backend/internal/handlers/handlers_user_related.go @@ -44,8 +44,8 @@ func (gs *GState) UserDelete(c *fiber.Ctx) error { // Read username from Locals auth_username := c.Locals("user").(*jwt.Token).Claims.(jwt.MapClaims)["name"].(string) - if username != auth_username { - return c.Status(403).SendString("You can only delete yourself") + if username == auth_username { + return c.Status(403).SendString("You can't delete yourself") } if err := gs.Db.RemoveUser(username); err != nil {