summaryrefslogtreecommitdiffstats
path: root/routers/web/web.go
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-04-12 04:02:58 +0200
committerGitHub <noreply@github.com>2022-04-12 10:02:58 +0800
commit0d3d9675c62b3ad7ebcfd7a7515bbe9c3c769262 (patch)
tree0df4a80f70524c93645669c90c8477aee1669215 /routers/web/web.go
parentd139c23967a2a376ce61acd9a7a1af5887b818f1 (diff)
downloadgitea-0d3d9675c62b3ad7ebcfd7a7515bbe9c3c769262.tar.gz
gitea-0d3d9675c62b3ad7ebcfd7a7515bbe9c3c769262.zip
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.
Diffstat (limited to 'routers/web/web.go')
-rw-r--r--routers/web/web.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/routers/web/web.go b/routers/web/web.go
index 190ab099e0..0de6f13722 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -429,8 +429,8 @@ func RegisterRoutes(m *web.Route) {
m.Group("/user", func() {
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
- m.Get("/activate", auth.Activate, reqSignIn)
- m.Post("/activate", auth.ActivatePost, reqSignIn)
+ m.Get("/activate", auth.Activate)
+ m.Post("/activate", auth.ActivatePost)
m.Any("/activate_email", auth.ActivateEmail)
m.Get("/avatar/{username}/{size}", user.AvatarByUserName)
m.Get("/recover_account", auth.ResetPasswd)
@@ -438,9 +438,9 @@ func RegisterRoutes(m *web.Route) {
m.Get("/forgot_password", auth.ForgotPasswd)
m.Post("/forgot_password", auth.ForgotPasswdPost)
m.Post("/logout", auth.SignOut)
- m.Get("/task/{task}", user.TaskStatus)
- m.Get("/stopwatches", user.GetStopwatches, reqSignIn)
- m.Get("/search", user.Search, ignExploreSignIn)
+ m.Get("/task/{task}", reqSignIn, user.TaskStatus)
+ m.Get("/stopwatches", reqSignIn, user.GetStopwatches)
+ m.Get("/search", ignExploreSignIn, user.Search)
})
// ***** END: User *****