wip
This commit is contained in:
parent
515c748e14
commit
bd4a475923
23 changed files with 1217 additions and 192 deletions
24
user.go
Normal file
24
user.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
// External
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID int
|
||||
Username string
|
||||
Password string
|
||||
Name string
|
||||
}
|
||||
|
||||
func NewUser(claims jwt.MapClaims) (u User) {
|
||||
uid, _ := claims["uid"].(float64)
|
||||
name, _ := claims["name"].(string)
|
||||
username, _ := claims["login"].(string)
|
||||
|
||||
u.ID = int(uid)
|
||||
u.Username = username
|
||||
u.Name = name
|
||||
return
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue