fix: custom token expires in doesn't work

pull/1831/head v3.0.3
Noah Hsu 2022-09-27 14:23:56 +08:00
parent a624121095
commit dc73c2e97d
2 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@ on:
schedule:
- cron: "0 0 */7 * *"
workflow_dispatch:
jobs:
close-inactive:
runs-on: ubuntu-latest

View File

@ -3,6 +3,7 @@ package common
import (
"time"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/golang-jwt/jwt/v4"
"github.com/pkg/errors"
)
@ -18,7 +19,7 @@ func GenerateToken(username string) (tokenString string, err error) {
claim := UserClaims{
Username: username,
RegisteredClaims: jwt.RegisteredClaims{
ExpiresAt: jwt.NewNumericDate(time.Now().Add(48 * time.Hour)),
ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Duration(conf.Conf.TokenExpiresIn) * time.Hour)),
IssuedAt: jwt.NewNumericDate(time.Now()),
NotBefore: jwt.NewNumericDate(time.Now()),
}}