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
|
// 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 {
|
||||||
log.Info("User tried to delete another user")
|
log.Info("User tried to delete itself")
|
||||||
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 {
|
||||||
|
|
Loading…
Reference in a new issue