aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/auth/jwt.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-07-28 03:15:08 +0900
committernsfisis <nsfisis@gmail.com>2024-07-28 03:15:08 +0900
commit569eb3753db04c2ceca8d005b3e1cef15cfe8eb7 (patch)
tree9cb80bf9642e1e7d6146551d81fd57988bb240df /backend/auth/jwt.go
parentf106dfda762b499af52a741f682c34abb83d27d9 (diff)
downloadphperkaigi-2025-albatross-569eb3753db04c2ceca8d005b3e1cef15cfe8eb7.tar.gz
phperkaigi-2025-albatross-569eb3753db04c2ceca8d005b3e1cef15cfe8eb7.tar.zst
phperkaigi-2025-albatross-569eb3753db04c2ceca8d005b3e1cef15cfe8eb7.zip
rename user's display_username to display_name
Diffstat (limited to 'backend/auth/jwt.go')
-rw-r--r--backend/auth/jwt.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/backend/auth/jwt.go b/backend/auth/jwt.go
index aa35de6..1b153fe 100644
--- a/backend/auth/jwt.go
+++ b/backend/auth/jwt.go
@@ -11,11 +11,11 @@ import (
)
type JWTClaims struct {
- UserID int `json:"user_id"`
- Username string `json:"username"`
- DisplayUsername string `json:"display_username"`
- IconPath *string `json:"icon_path"`
- IsAdmin bool `json:"is_admin"`
+ UserID int `json:"user_id"`
+ Username string `json:"username"`
+ DisplayName string `json:"display_name"`
+ IconPath *string `json:"icon_path"`
+ IsAdmin bool `json:"is_admin"`
jwt.RegisteredClaims
}
@@ -25,11 +25,11 @@ func NewJWT(user *db.User) (string, error) {
iconPath = &user.IconPath.String
}
claims := &JWTClaims{
- UserID: int(user.UserID),
- Username: user.Username,
- DisplayUsername: user.DisplayUsername,
- IconPath: iconPath,
- IsAdmin: user.IsAdmin,
+ UserID: int(user.UserID),
+ Username: user.Username,
+ DisplayName: user.DisplayName,
+ IconPath: iconPath,
+ IsAdmin: user.IsAdmin,
RegisteredClaims: jwt.RegisteredClaims{
ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Hour * 24)),
},