mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
Improve error handling in AutoSigninFilter
This commit is contained in:
@ -58,8 +58,10 @@ func Time2String(timestamp time.Time) string {
|
||||
return timestamp.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
func IsTokenExpired(createdTime string, expiresIn int) bool {
|
||||
func IsTokenExpired(createdTime string, expiresIn int) (bool, string) {
|
||||
createdTimeObj, _ := time.Parse(time.RFC3339, createdTime)
|
||||
expiresAtObj := createdTimeObj.Add(time.Duration(expiresIn) * time.Second)
|
||||
return time.Now().After(expiresAtObj)
|
||||
isExpired := time.Now().After(expiresAtObj)
|
||||
expireTime := expiresAtObj.Local().Format(time.RFC3339)
|
||||
return isExpired, expireTime
|
||||
}
|
||||
|
Reference in New Issue
Block a user