func ActivateEmail(ctx *context.Context) {
	code := ctx.Query("code")
	emailStr := ctx.Query("email")

	// Verify code.
	if email := models.VerifyActiveEmailCode(code, emailStr); email != nil {
		if err := email.Activate(); err != nil {
			ctx.ServerError("ActivateEmail", err)
		}

		log.Trace("Email activated: %s", email.Email)
		ctx.Flash.Success(ctx.Tr("settings.add_email_success"))

		if u, err := models.GetUserByID(email.UID); err != nil {
			log.Warn("GetUserByID: %d", email.UID)
		} else {
			// Allow user to validate more emails
			_ = ctx.Cache.Delete("MailResendLimit_" + u.LowerName)
		}
	}

	// FIXME: e-mail verification does not require the user to be logged in,
	// so this could be redirecting to the login page.
	// Should users be logged in automatically here? (consider 2FA requirements, etc.)
	ctx.Redirect(setting.AppSubURL + "/user/settings/account")
}
// ActivateEmail render the activate email page
ActivateEmail render the activate email page
// ActivateEmail render the activate email page
func ActivateEmail(ctx *context.Context) {
	code := ctx.Query("code")
	emailStr := ctx.Query("email")
	if email := models.VerifyActiveEmailCode(code, emailStr); email != nil {
		if err := email.Activate(); err != nil {
			ctx.ServerError("ActivateEmail", err)
		}
		log.Trace("Email activated: %s", email.Email)
		ctx.Flash.Success(ctx.Tr("settings.add_email_success"))
		if u, err := models.GetUserByID(email.UID); err != nil {
			log.Warn("GetUserByID: %d", email.UID)
		} else {
			_ = ctx.Cache.Delete("MailResendLimit_" + u.LowerName)
		}
	}
	ctx.Redirect(setting.AppSubURL + "/user/settings/account")
}
func ActivateEmail ( ctx * context . Context ) { code := ctx . Query ( " " ) emailStr := ctx . Query ( " " ) if email := models . VerifyActiveEmailCode ( code , emailStr ) ; email != nil { if err := email . Activate ( ) ; err != nil { ctx . ServerError ( " " , err ) } log . Trace ( " " , email . Email ) ctx . Flash . Success ( ctx . Tr ( " " ) ) if u , err := models . GetUserByID ( email . UID ) ; err != nil { log . Warn ( " " , email . UID ) } else { _ = ctx . Cache . Delete ( " " + u . LowerName ) } } ctx . Redirect ( setting . AppSubURL + " " ) }
ActivateEmail render the activate email page
ActivateEmail render the activate email page
// Verify code. // Allow user to validate more emails // FIXME: e-mail verification does not require the user to be logged in, // so this could be redirecting to the login page. // Should users be logged in automatically here? (consider 2FA requirements, etc.)