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

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