You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lib/captcha/captcha.go

17 lines
408 B
Go

package captcha
import (
"github.com/mojocn/base64Captcha"
)
// Generate 產生驗證圖示
func Generate() (string, string, error) {
driver := base64Captcha.NewDriverDigit(80, 160, 4, 0.1, 4)
return base64Captcha.NewCaptcha(driver, base64Captcha.DefaultMemStore).Generate()
}
// Verify 驗證驗證碼
func Verify(id, code string) bool {
return base64Captcha.DefaultMemStore.Verify(id, code, true)
}