Fix in handler

This commit is contained in:
Peter KW 2024-03-28 12:37:04 +01:00
parent cef7b34092
commit 50042ded41

View file

@ -59,9 +59,9 @@ 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 {
log.Info("User tried to delete another user")
return c.Status(403).SendString("You can only delete yourself")
if username == auth_username {
log.Info("User tried to delete itself")
return c.Status(403).SendString("You can't delete yourself")
}
if err := gs.Db.RemoveUser(username); err != nil {