mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 18:35:51 +02:00
feat(wip): site category
This commit is contained in:
parent
ed3c02fc6f
commit
7ad5cac3b8
73 changed files with 713 additions and 235 deletions
|
@ -46,16 +46,16 @@ func secureSessionIDCacheKey(sessionId string) string {
|
|||
return fmt.Sprintf("2fa_secure_session:_%s", sessionId)
|
||||
}
|
||||
|
||||
func SetSecureSessionID(userId int) (sessionId string) {
|
||||
func SetSecureSessionID(userId uint64) (sessionId string) {
|
||||
sessionId = uuid.NewString()
|
||||
cache.Set(secureSessionIDCacheKey(sessionId), userId, 5*time.Minute)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func VerifySecureSessionID(sessionId string, userId int) bool {
|
||||
func VerifySecureSessionID(sessionId string, userId uint64) bool {
|
||||
if v, ok := cache.Get(secureSessionIDCacheKey(sessionId)); ok {
|
||||
if v.(int) == userId {
|
||||
if v.(uint64) == userId {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ const ExpiredTime = 24 * time.Hour
|
|||
|
||||
type JWTClaims struct {
|
||||
Name string `json:"name"`
|
||||
UserID int `json:"user_id"`
|
||||
UserID uint64 `json:"user_id"`
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue