Skip to content

Commit 0d3d967

Browse files
author
Gusted
authored
Fix middleware function's placements for some /user/... (#19377)
- Add reqSignIn to `/user/task/{task}` as it specific to a logged in user currently not-logged in user could cause a NPE. - Move `/user/stopwatch` & `/user/search` middleware before the actual function is called, because functions are executed in order and currently hadn't any effect and could as well cause a NPE due to that. - Remove `/user/active` reqSignIn middleware, because when you want to active a account you're not "signed in" so it doesn't make sense to add that middleware.
1 parent d139c23 commit 0d3d967

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

routers/web/web.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,18 +429,18 @@ func RegisterRoutes(m *web.Route) {
429429

430430
m.Group("/user", func() {
431431
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
432-
m.Get("/activate", auth.Activate, reqSignIn)
433-
m.Post("/activate", auth.ActivatePost, reqSignIn)
432+
m.Get("/activate", auth.Activate)
433+
m.Post("/activate", auth.ActivatePost)
434434
m.Any("/activate_email", auth.ActivateEmail)
435435
m.Get("/avatar/{username}/{size}", user.AvatarByUserName)
436436
m.Get("/recover_account", auth.ResetPasswd)
437437
m.Post("/recover_account", auth.ResetPasswdPost)
438438
m.Get("/forgot_password", auth.ForgotPasswd)
439439
m.Post("/forgot_password", auth.ForgotPasswdPost)
440440
m.Post("/logout", auth.SignOut)
441-
m.Get("/task/{task}", user.TaskStatus)
442-
m.Get("/stopwatches", user.GetStopwatches, reqSignIn)
443-
m.Get("/search", user.Search, ignExploreSignIn)
441+
m.Get("/task/{task}", reqSignIn, user.TaskStatus)
442+
m.Get("/stopwatches", reqSignIn, user.GetStopwatches)
443+
m.Get("/search", ignExploreSignIn, user.Search)
444444
})
445445
// ***** END: User *****
446446

0 commit comments

Comments
 (0)