Should be able to delete users except for self now

This commit is contained in:
Peter KW 2024-03-19 00:14:55 +01:00
parent 83e781c877
commit e55b380bb4

View file

@ -44,8 +44,8 @@ func (gs *GState) UserDelete(c *fiber.Ctx) error {
// Read username from Locals // Read username from Locals
auth_username := c.Locals("user").(*jwt.Token).Claims.(jwt.MapClaims)["name"].(string) auth_username := c.Locals("user").(*jwt.Token).Claims.(jwt.MapClaims)["name"].(string)
if username != auth_username { if username == auth_username {
return c.Status(403).SendString("You can only delete yourself") return c.Status(403).SendString("You can't delete yourself")
} }
if err := gs.Db.RemoveUser(username); err != nil { if err := gs.Db.RemoveUser(username); err != nil {