From 74ed664c797ec0741aead70c20cac651df14b53e Mon Sep 17 00:00:00 2001 From: Minho Date: Thu, 1 Mar 2018 13:43:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E8=83=BD=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/account.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/account.go b/controllers/account.go index 2df3d192..12b21450 100644 --- a/controllers/account.go +++ b/controllers/account.go @@ -133,6 +133,10 @@ func (c *AccountController) LoggedIn(isPost bool) interface{} { func (c *AccountController) Register() { c.TplName = "account/register.tpl" + //如果用户登录了,则跳转到网站首页 + if member, ok := c.GetSession(conf.LoginSessionName).(models.Member); ok && member.MemberId > 0 { + c.Redirect(beego.URLFor("HomeController.Index"),302) + } // 如果没有开启用户注册 if v, ok := c.Option["ENABLED_REGISTER"]; ok && !strings.EqualFold(v, "true") { c.Abort("404")