go-captcha icon indicating copy to clipboard operation
go-captcha copied to clipboard

设置字符集为英文字母时,验证容易报错

Open fqw123 opened this issue 2 years ago • 1 comments

  1. 设置英文字符集

chars := "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

_ = capt.SetRangChars(strings.Split(chars, ""))

capt = captcha.GetCaptcha()

dots, b64, tb64, key, err := capt.Generate()

  1. 前端点选结果

{"dot":"110,198,48,88,197,72","key":"c39190357e6e59043729c59a8fa99a71"} image

  1. 实际点选结果 {"0":{"Index":0,"Dx":105,"Dy":227,"Size":38,"Width":38,"Height":38,"Text":"N","Angle":330,"Color":"#fcb08e","Color2":"#6e3700"},"1":{"Index":1,"Dx":50,"Dy":111,"Size":31,"Width":31,"Height":31,"Text":"A","Angle":20,"Color":"#60c1ff","Color2":"#6e3700"},"2":{"Index":2,"Dx":193,"Dy":96,"Size":37,"Width":37,"Height":37,"Text":"F","Angle":325,"Color":"#b4fed4","Color2":"#660033"}}

期望和汉字的验证效果一致

fqw123 avatar Sep 11 '23 10:09 fqw123

  1. 设置英文字符集

chars := "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

_ = capt.SetRangChars(strings.Split(chars, ""))

capt = captcha.GetCaptcha()

dots, b64, tb64, key, err := capt.Generate()

  1. 前端点选结果

{"dot":"110,198,48,88,197,72","key":"c39190357e6e59043729c59a8fa99a71"} image

  1. 实际点选结果 {"0":{"Index":0,"Dx":105,"Dy":227,"Size":38,"Width":38,"Height":38,"Text":"N","Angle":330,"Color":"#fcb08e","Color2":"#6e3700"},"1":{"Index":1,"Dx":50,"Dy":111,"Size":31,"Width":31,"Height":31,"Text":"A","Angle":20,"Color":"#60c1ff","Color2":"#6e3700"},"2":{"Index":2,"Dx":193,"Dy":96,"Size":37,"Width":37,"Height":37,"Text":"F","Angle":325,"Color":"#b4fed4","Color2":"#660033"}}

期望和汉字的验证效果一致

嘿嘿,v2 的位置计算将更精准了,即将发布,可关注一下!

wenlng avatar May 18 '24 14:05 wenlng