如果没有开启匿名访问,屏蔽搜索

pull/25/merge
Minho 2017-05-05 11:40:59 +08:00
parent 3e2d6bdd36
commit 096eb8edd1
1 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,12 @@ func (c *SearchController) Index() {
c.Prepare()
c.TplName = "search/index.tpl"
//如果没有开启你们访问则跳转到登录
if !c.EnableAnonymous && c.Member == nil {
c.Redirect(beego.URLFor("AccountController.Login"),302)
return
}
keyword := c.GetString("keyword")
pageIndex,_ := c.GetInt("page",1)