added return clause after redirection.

This commit is contained in:
wknet123 2016-02-25 11:48:22 +08:00
parent bfd96c9373
commit 634f69b2c5
2 changed files with 6 additions and 0 deletions

View File

@ -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 {

View File

@ -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}