Merge remote-tracking branch 'origin/frontend' into BumBranch
This commit is contained in:
commit
09f2a2202f
13 changed files with 287 additions and 48 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue