Feat v0.6.9 cookie fix roadmap (#44)
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #44.
This commit is contained in:
@@ -50,10 +50,17 @@ func AuthOrRedirect(cfg *config.Config, users store.UserStore, cache *UserStatus
|
||||
return
|
||||
}
|
||||
|
||||
// Try strict validation first (token not expired).
|
||||
claims, ok := parseAndValidateJWT(tokenString, cfg.JWTSecret)
|
||||
if !ok {
|
||||
redirectToLogin(c, loginPath)
|
||||
return
|
||||
// Fallback: accept an expired-but-signed token so the page
|
||||
// shell can render and the Preact SDK can refresh client-side.
|
||||
// A tampered/unsigned token still gets rejected.
|
||||
claims, ok = parseJWTIgnoringExpiry(tokenString, cfg.JWTSecret)
|
||||
if !ok {
|
||||
redirectToLogin(c, loginPath)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if claims.UserID == "" {
|
||||
|
||||
Reference in New Issue
Block a user