LinkinStars commented on issue #1334:
URL: https://github.com/apache/answer/issues/1334#issuecomment-2904294162

   @Giorgio-Bonvicini-R4P Great! Your detailed steps helped.
   
   We finally reproduced the problem. You were right. The problem was with the 
same cookie.
   
   > the cookie is still set to visit=XYZ (same as before, **this is what looks 
suspicious to me**)
   
   After `log out`(step 7), the old cookie A will be ineffective. However, in 
the 8 step, since the previous cookie was not deleted, the new cookie was not 
set. So the old cookie was used to continue accessing the site, causing the 
problem.
   
   I think the following modification should solve the problem.
   
   
https://github.com/apache/answer/blob/3f1ed50f6776452c11b6ffdbdc767cd1887d629b/internal/controller/user_controller.go#L719-L723
   
   ```diff
   -    cookie, err := ctx.Cookie(constant.UserVisitCookiesCacheKey) 
   -    if err == nil && len(cookie) > 0 && !force { 
   -            return 
   -    } 
   +    if !force {
   +            cookie, _ := ctx.Cookie(constant.UserVisitCookiesCacheKey)
   +            // If the cookie is the same as the visitToken, no need to set 
it again
   +            if cookie == visitToken {
   +                    return
   +            }
   +    }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@answer.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to