Files
zeekay e22bc61295 beego v1 fork: hanzoai/beego (module path) + zero mattn/go-sqlite3
Faithful fork of upstream beego v1.12.12 with two changes only:
- module path github.com/beego/beego -> github.com/hanzoai/beego (all
  internal imports repointed)
- orm sqlite3 test driver mattn/go-sqlite3 -> hanzoai/csqlite (drop-in);
  drops the bogus 'mattn/go-sqlite3 v2.0.3+incompatible' pin that poisoned
  every consumer's module graph via beego v1's go.mod.

go build ./... green; go list -deps mattn = 0; grep mattn go.mod = 0.
Behavior identical to upstream v1.12.12 (no logic changes). Lets ai repoint
its beego-v1 web layer by import path only, preserving exact runtime behavior.
2026-07-12 21:45:31 -07:00

728 B

Captcha

an example for use captcha

package controllers

import (
	"github.com/beego/beego"
	"github.com/beego/beego/cache"
	"github.com/beego/beego/utils/captcha"
)

var cpt *captcha.Captcha

func init() {
	// use beego cache system store the captcha data
	store := cache.NewMemoryCache()
	cpt = captcha.NewWithFilter("/captcha/", store)
}

type MainController struct {
	beego.Controller
}

func (this *MainController) Get() {
	this.TplName = "index.tpl"
}

func (this *MainController) Post() {
	this.TplName = "index.tpl"

	this.Data["Success"] = cpt.VerifyReq(this.Ctx.Request)
}

template usage

{{.Success}}
<form action="/" method="post">
	{{create_captcha}}
	<input name="captcha" type="text">
</form>