This commit is contained in:
刘河
2019-01-29 11:20:39 +08:00
parent b3dd70062b
commit f0c6eff23a
8 changed files with 56 additions and 12 deletions

View File

@@ -19,8 +19,11 @@ func (s *BaseController) Prepare() {
controllerName, actionName := s.GetControllerAndAction()
s.controllerName = strings.ToLower(controllerName[0 : len(controllerName)-10])
s.actionName = strings.ToLower(actionName)
if s.GetSession("auth") != true {
s.Redirect("/login/index", 302)
arr := strings.Split(s.Ctx.Request.RemoteAddr, ":")
if len(arr) > 0 && arr[0] != beego.AppConfig.String("authip") {
if s.GetSession("auth") != true {
s.Redirect("/login/index", 302)
}
}
}