You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, congratulations for your excellent work on Beego and Wetalk!
I was playing a bit with Wetalk and found out that session store doesn't work when FileSessionStore is used as provider (everything works fine with MemSessionStore). The problem seems similar to this Beego ticket - if a user logs in and opens a protected page (User Home or User Profile) and then refreshes (reloads) that page in a browser, (s)he automatically lands on the login page again.
After inspecting the code, I found this chunk of code suspicious (modules/auth/auth.go):
funcLoginUser(user*models.User, ctx*context.Context, rememberbool) {
// weird way of beego session regenerate id...ctx.Input.CruSession.SessionRelease(ctx.ResponseWriter)
ctx.Input.CruSession=beego.GlobalSessions.SessionRegenerateId(ctx.ResponseWriter, ctx.Request)
ctx.Input.CruSession.Set("auth_user_id", user.Id)
The problem is that the method Set is called after the SessionRelease (which saves the session) and therefore "auth_user_id" is not saved at all. You can put ctx.Input.CruSession.Setin front of ctx.Input.CruSession.SessionRelease but it doesn't solve the problem - SessionRegenerate doesn't decode "auth_user_id" value properly. I didn't investigate this further - maybe there is something wrong with init function in astaxie/beego/session/sess_utils.go...
The text was updated successfully, but these errors were encountered:
First of all, congratulations for your excellent work on Beego and Wetalk!
I was playing a bit with Wetalk and found out that session store doesn't work when FileSessionStore is used as provider (everything works fine with
MemSessionStore
). The problem seems similar to this Beego ticket - if a user logs in and opens a protected page (User Home or User Profile) and then refreshes (reloads) that page in a browser, (s)he automatically lands on the login page again.After inspecting the code, I found this chunk of code suspicious (modules/auth/auth.go):
The problem is that the method
Set
is called after theSessionRelease
(which saves the session) and therefore "auth_user_id" is not saved at all. You can putctx.Input.CruSession.Set
in front ofctx.Input.CruSession.SessionRelease
but it doesn't solve the problem -SessionRegenerate
doesn't decode "auth_user_id" value properly. I didn't investigate this further - maybe there is something wrong withinit
function in astaxie/beego/session/sess_utils.go...The text was updated successfully, but these errors were encountered: