func ActivatePost(ctx *context.Context) {
	code := ctx.Query("code")
	if len(code) == 0 {
		ctx.Redirect(setting.AppSubURL + "/user/activate")
		return
	}

	user := models.VerifyUserActiveCode(code)
	// if code is wrong
	if user == nil {
		ctx.Data["IsActivateFailed"] = true
		ctx.HTML(http.StatusOK, TplActivate)
		return
	}

	// if account is local account, verify password
	if user.LoginSource == 0 {
		password := ctx.Query("password")
		if len(password) == 0 {
			ctx.Data["Code"] = code
			ctx.Data["NeedsPassword"] = true
			ctx.HTML(http.StatusOK, TplActivate)
			return
		}
		if !user.ValidatePassword(password) {
			ctx.Data["IsActivateFailed"] = true
			ctx.HTML(http.StatusOK, TplActivate)
			return
		}
	}

	handleAccountActivation(ctx, user)
}
// ActivatePost handles account activation with password check
ActivatePost handles account activation with password check
// ActivatePost handles account activation with password check
func ActivatePost(ctx *context.Context) {
	code := ctx.Query("code")
	if len(code) == 0 {
		ctx.Redirect(setting.AppSubURL + "/user/activate")
		return
	}
	user := models.VerifyUserActiveCode(code)
	if user == nil {
		ctx.Data["IsActivateFailed"] = true
		ctx.HTML(http.StatusOK, TplActivate)
		return
	}
	if user.LoginSource == 0 {
		password := ctx.Query("password")
		if len(password) == 0 {
			ctx.Data["Code"] = code
			ctx.Data["NeedsPassword"] = true
			ctx.HTML(http.StatusOK, TplActivate)
			return
		}
		if !user.ValidatePassword(password) {
			ctx.Data["IsActivateFailed"] = true
			ctx.HTML(http.StatusOK, TplActivate)
			return
		}
	}
	handleAccountActivation(ctx, user)
}
func ActivatePost ( ctx * context . Context ) { code := ctx . Query ( " " ) if len ( code ) == 0 { ctx . Redirect ( setting . AppSubURL + " " ) return } user := models . VerifyUserActiveCode ( code ) if user == nil { ctx . Data [ " " ] = true ctx . HTML ( http . StatusOK , TplActivate ) return } if user . LoginSource == 0 { password := ctx . Query ( " " ) if len ( password ) == 0 { ctx . Data [ " " ] = code ctx . Data [ " " ] = true ctx . HTML ( http . StatusOK , TplActivate ) return } if ! user . ValidatePassword ( password ) { ctx . Data [ " " ] = true ctx . HTML ( http . StatusOK , TplActivate ) return } } handleAccountActivation ( ctx , user ) }
ActivatePost handles account activation with password check
ActivatePost handles account activation with password check
// if code is wrong // if account is local account, verify password