Skip to content

Commit

Permalink
fix: custom token expires in doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Sep 27, 2022
1 parent a624121 commit dc73c2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/issue_close_inactive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
schedule:
- cron: "0 0 */7 * *"
workflow_dispatch:

jobs:
close-inactive:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion server/common/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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()),
}}
Expand Down

0 comments on commit dc73c2e

Please sign in to comment.