将验证码配置到配置文件中 增加ie适配css

This commit is contained in:
QM303176530
2020-03-18 20:34:25 +08:00
parent 041b9e475a
commit 850d188e72
5 changed files with 23 additions and 15 deletions
+2 -2
View File
@@ -3,6 +3,7 @@ package servers
import (
"bytes"
"fmt"
"gin-vue-admin/config"
"github.com/dchest/captcha"
"net/http"
"path"
@@ -25,7 +26,7 @@ func GinCapthcaServeHTTP(w http.ResponseWriter, r *http.Request) {
}
lang := strings.ToLower(r.FormValue("lang"))
download := path.Base(dir) == "download"
if Serve(w, r, id, ext, lang, download, 120, 40) == captcha.ErrNotFound {
if Serve(w, r, id, ext, lang, download, config.GinVueAdminconfig.Captcha.ImgWidth, config.GinVueAdminconfig.Captcha.ImgHeight) == captcha.ErrNotFound {
http.NotFound(w, r)
}
}
@@ -52,4 +53,3 @@ func Serve(w http.ResponseWriter, r *http.Request, id, ext, lang string, downloa
http.ServeContent(w, r, id+ext, time.Time{}, bytes.NewReader(content.Bytes()))
return nil
}