未开启匿名访问时能够访问公开项目

This commit is contained in:
Minho
2017-05-03 17:09:01 +08:00
parent 8075b0dc81
commit 4d51baf42f
5 changed files with 20 additions and 14 deletions

View File

@@ -91,6 +91,11 @@ func (c *DocumentController) Index() {
if identify == "" {
c.Abort("404")
}
//如果没有开启你们访问则跳转到登录
if !c.EnableAnonymous && c.Member == nil {
c.Redirect(beego.URLFor("AccountController.Login"),302)
return
}
bookResult := isReadable(identify,token,c)
@@ -119,6 +124,13 @@ func (c *DocumentController) Read() {
if identify == "" || id == ""{
c.Abort("404")
}
//如果没有开启你们访问则跳转到登录
if !c.EnableAnonymous && c.Member == nil {
c.Redirect(beego.URLFor("AccountController.Login"),302)
return
}
bookResult := isReadable(identify,token,c)
c.TplName = "document/" + bookResult.Theme + "_read.tpl"