当用户登录时不能注册

pull/219/merge
Minho 2018-03-01 13:43:32 +08:00
parent 579197d146
commit 74ed664c79
1 changed files with 4 additions and 0 deletions

View File

@ -133,6 +133,10 @@ func (c *AccountController) LoggedIn(isPost bool) interface{} {
func (c *AccountController) Register() { func (c *AccountController) Register() {
c.TplName = "account/register.tpl" 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") { if v, ok := c.Option["ENABLED_REGISTER"]; ok && !strings.EqualFold(v, "true") {
c.Abort("404") c.Abort("404")