From 634f69b2c561d65c119f794515ae22777436614b Mon Sep 17 00:00:00 2001 From: wknet123 Date: Thu, 25 Feb 2016 11:48:22 +0800 Subject: [PATCH] added return clause after redirection. --- controllers/item_detail.go | 4 ++++ controllers/password.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/controllers/item_detail.go b/controllers/item_detail.go index 5721047a8..cf5214fcd 100644 --- a/controllers/item_detail.go +++ b/controllers/item_detail.go @@ -36,6 +36,7 @@ func (idc *ItemDetailController) Get() { if projectId <= 0 { beego.Error("Invalid project id:", projectId) idc.Redirect("/signIn", http.StatusFound) + return } project, err := dao.GetProjectById(projectId) @@ -47,12 +48,14 @@ func (idc *ItemDetailController) Get() { if project == nil { idc.Redirect("/signIn", http.StatusFound) + return } sessionUserId := idc.GetSession("userId") if project.Public != 1 && sessionUserId == nil { idc.Redirect("/signIn?uri="+url.QueryEscape(idc.Ctx.Input.URI()), http.StatusFound) + return } if sessionUserId != nil { @@ -68,6 +71,7 @@ func (idc *ItemDetailController) Get() { if project.Public == 0 && len(roleList) == 0 { idc.Redirect("/registry/project", http.StatusFound) + return } if len(roleList) > 0 { diff --git a/controllers/password.go b/controllers/password.go index aede09a0d..9b9ecc0af 100644 --- a/controllers/password.go +++ b/controllers/password.go @@ -36,6 +36,7 @@ func (cpc *ChangePasswordController) Get() { sessionUserId := cpc.GetSession("userId") if sessionUserId == nil { cpc.Redirect("/signIn", http.StatusFound) + return } cpc.Data["Username"] = cpc.GetSession("username") cpc.ForwardTo("page_title_change_password", "change-password") @@ -179,6 +180,7 @@ func (rpc *ResetPasswordController) Get() { if resetUuid == "" { beego.Error("Reset uuid is blank.") rpc.Redirect("/", http.StatusFound) + return } queryUser := models.User{ResetUuid: resetUuid}