Skip to content

Commit

Permalink
Fix middleware function's placements for /user/... (#19377) (#19378)
Browse files Browse the repository at this point in the history
- Backport #19377
  - Add reqSignIn to `/user/task/{task}` as it specific to a logged in user currently not-logged in user could cause a NPE.
  - 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.
  • Loading branch information
Gusted committed Apr 12, 2022
1 parent 61c7732 commit ee3a21a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions routers/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,16 @@ 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)
m.Post("/recover_account", auth.ResetPasswdPost)
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("/task/{task}", reqSignIn, user.TaskStatus)
})
// ***** END: User *****

Expand Down

0 comments on commit ee3a21a

Please sign in to comment.