Spaces:
Sleeping
Sleeping
| package utils | |
| import ( | |
| "image/color" | |
| "github.com/mojocn/base64Captcha" | |
| ) | |
| var store = base64Captcha.DefaultMemStore | |
| // GetCaptcha ่ทๅ้ช่ฏ็ | |
| func GetCaptcha() (string, string, string, error) { | |
| driver := base64Captcha.NewDriverMath(60, 180, 80, 0, &color.RGBA{255, 255, 255, 255}, nil, nil) | |
| return base64Captcha.NewCaptcha(driver, store).Generate() | |
| } | |
| // VerifyCaptcha ้ช่ฏ้ช่ฏ็ | |
| func VerifyCaptcha(id string, answer string) bool { | |
| return store.Verify(id, answer, true) | |
| } | |