Lagt till om Admin=True/false
This commit is contained in:
parent
cb44954477
commit
b7b831d869
1 changed files with 6 additions and 1 deletions
|
@ -101,10 +101,15 @@ func (gs *GState) Login(c *fiber.Ctx) error {
|
|||
return c.SendStatus(fiber.StatusUnauthorized)
|
||||
}
|
||||
|
||||
isAdmin, err := gs.Db.IsSiteAdmin(u.Username)
|
||||
if err != nil {
|
||||
log.Info("Error checking admin status:", err)
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
// Create the Claims
|
||||
claims := jwt.MapClaims{
|
||||
"name": u.Username,
|
||||
"admin": false,
|
||||
"admin": isAdmin,
|
||||
"exp": time.Now().Add(time.Hour * 72).Unix(),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue