Should be able to delete users except for self now
This commit is contained in:
parent
83e781c877
commit
e55b380bb4
1 changed files with 2 additions and 2 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue