Fix in handler
This commit is contained in:
parent
cef7b34092
commit
50042ded41
1 changed files with 3 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue