Skip to content

Commit d70599f

Browse files
author
QM303176530
committed
验证码配置参数修改进配置文件,前端角色id不再允许输入英文字符
1 parent 0dcb026 commit d70599f

File tree

3 files changed

+131
-118
lines changed

3 files changed

+131
-118
lines changed

server/api/v1/sys_captcha.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package v1
22

33
import (
44
"fmt"
5+
"gin-vue-admin/global"
56
"gin-vue-admin/global/response"
67
resp "gin-vue-admin/model/response"
78
"github.com/gin-gonic/gin"
@@ -20,7 +21,7 @@ var store = base64Captcha.DefaultMemStore
2021
func Captcha(c *gin.Context) {
2122
//字符,公式,验证码配置
2223
// 生成默认数字的driver
23-
driver := base64Captcha.NewDriverDigit(80, 240, 5, 0.7, 80)
24+
driver := base64Captcha.NewDriverDigit(global.GVA_CONFIG.Captcha.ImgHeight, global.GVA_CONFIG.Captcha.ImgWidth, global.GVA_CONFIG.Captcha.KeyLong, 0.7, 80)
2425
cp := base64Captcha.NewCaptcha(driver, store)
2526
id, b64s, err := cp.Generate()
2627
if err != nil {

server/config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ system:
4646

4747
# captcha configuration
4848
captcha:
49-
key-long: 4
50-
img-width: 120
51-
img-height: 40
49+
key-long: 6
50+
img-width: 240
51+
img-height: 80
5252

5353
# logger configuration
5454
log:

0 commit comments

Comments
 (0)