Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么设置字段出现概率,现在刷新好几次都没有出现缩略图内字段 #3

Closed
cavey1230 opened this issue Nov 22, 2022 · 5 comments

Comments

@cavey1230
Copy link

No description provided.

@wenlng
Copy link
Owner

wenlng commented Nov 22, 2022

No description provided.

你检查一下缩略图的校验文本随机范围长度的 SetRangCheckTextLen 和 主图显示的文本随机范围长度的 SetTextRangLen

@cavey1230
Copy link
Author

chars := []string{"HE", "CA", "WO", "NE", "HT"}

Capt.SetTextRangLen(captcha.RangeVal{Min: 5, Max: 5})
Capt.SetRangCheckTextLen(captcha.RangeVal{Min: 1, Max: 1})

我现在是这样的

但是还是有概率刷不出来

@wenlng
Copy link
Owner

wenlng commented Nov 22, 2022

默认情况下是不需要设置 SetRangChars 的,因为内置有足够多的中文的文本种子。
如果实在需要自定义设置字母的种子,你将种子设置得多一些,最好是超过上百个。
目前你也可以自己写个函数专门生成A-Z由两个字符组成唯一的n多个组合,例如:{"HE", "CA", "WO", "NE", "HT", "IE", "PG", "GI", "CH", "CO", "DA" .... }。
还有就是 SetRangCheckTextLen 别设置那么短,理想是 3-5。

关于生成字母或数字组合的种子函数,在后面的版本中也会考虑加入。

@cavey1230
Copy link
Author

默认情况下是不需要设置 SetRangChars 的,因为内置有足够多的中文的文本种子。 如果实在需要自定义设置字母的种子,你将种子设置得多一些,最好是超过上百个。 目前你也可以自己写个函数专门生成A-Z由两个字符组成唯一的n多个组合,例如:{"HE", "CA", "WO", "NE", "HT", "IE", "PG", "GI", "CH", "CO", "DA" .... }。 还有就是 SetRangCheckTextLen 别设置那么短,理想是 3-5。

关于生成字母或数字组合的种子函数,在后面的版本中也会考虑加入。

好 我尝试这样做一下 需要ts版本的react 组件吗 可以给你提个pr

@wenlng
Copy link
Owner

wenlng commented Nov 26, 2022

感谢对go-captcha库的支持,在v2.0将有ts版的组件

@wenlng wenlng closed this as completed Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants