Пример #1
0
func (this *AuthController) Activate() {
	this.Data["PageTitle"] = fmt.Sprintf("用户激活 | %s", setting.AppName)
	code := this.Ctx.Input.Param(":code")
	user := models.User{}
	if user.VerifyActivateCode(code) {
		if this.IsStopForumSpamListed(&user) {
			this.FlashWrite("error", "由于你的ip或者电子邮件曾用来发广告,无法为你激活!")
		} else {
			user.IsActive = true
			user.Update()
			this.FlashWrite("notice", "谢谢,你的电子邮件已经验证!")
		}
	} else {
		this.FlashWrite("error", "糟糕,无法验证你的电子邮件!")
	}
	this.Redirect("/", 302)
}