Merge remote-tracking branch 'origin/frontend' into BumBranch

This commit is contained in:
al8763be 2024-03-28 16:45:39 +01:00
commit 09f2a2202f
13 changed files with 287 additions and 48 deletions

View file

@ -7,6 +7,8 @@ VALUES ("user", "123");
INSERT OR IGNORE INTO users(username, password)
VALUES ("user2", "123");
INSERT OR IGNORE INTO site_admin VALUES (1);
INSERT OR IGNORE INTO projects(name,description,owner_user_id)
VALUES ("projecttest","test project", 1);

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 {