Skip to content

Commit 73fb1ec

Browse files
Fixing redirection issue for logged-in users (#26105)
This PR addresses an issue where logged-in users get redirected to the homepage when trying to access a URL with the redirect_to parameter. The issue was traced back to a middleware function in services/auth/middleware.go that redirects logged-in users to the homepage. This function didn't account the redirect_to parameter. The fix modifies the middleware function to check for this case and redirect the user to the specified URL instead of the homepage. Closes: #26005 --------- Signed-off-by: cassiozareck <cassiomilczareck@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent c6975e5 commit 73fb1ec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

routers/web/web.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,9 @@ func registerRoutes(m *web.Route) {
374374
m.Get("/milestones", reqSignIn, reqMilestonesDashboardPageEnabled, user.Milestones)
375375

376376
// ***** START: User *****
377+
// "user/login" doesn't need signOut, then logged-in users can still access this route for redirection purposes by "/user/login?redirec_to=..."
378+
m.Get("/user/login", auth.SignIn)
377379
m.Group("/user", func() {
378-
m.Get("/login", auth.SignIn)
379380
m.Post("/login", web.Bind(forms.SignInForm{}), auth.SignInPost)
380381
m.Group("", func() {
381382
m.Combo("/login/openid").

0 commit comments

Comments
 (0)