验证码校验

This commit is contained in:
zhucheer 2019-11-14 13:52:34 +08:00
parent 595b233217
commit 42c1356a54
3 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package controller
import (
"fmt"
"gitee.com/zhucheer/orange/app"
"gitee.com/zhucheer/orange/captcha"
)
@ -35,3 +36,13 @@ func Upload(c *app.Context) error {
func Captcha(c *app.Context) error {
return captcha.CaptchaImgShow(c, 4)
}
func VerifyImg(c *app.Context) error {
code := c.Request().FormValue("code")
fmt.Println(code)
return c.ToJson(map[string]interface{}{
"result": "upload success",
})
}

View File

@ -19,6 +19,7 @@ func (s *Route) ServeMux() {
commonGp.ALL("/upload", controller.Upload)
commonGp.GET("/captcha", controller.Captcha)
commonGp.GET("/verifyimg", controller.VerifyImg)
}
authGp := app.GroupRouter("/auth", middleware.NewAuth())

View File

@ -1,7 +1,6 @@
package session
import (
"gitee.com/zhucheer/orange/logger"
"net/http"
)
@ -40,6 +39,6 @@ func (st *BlankSessionStore) Flush() (err error) {
}
func (st *BlankSessionStore) warningSession(funcName string) (err error) {
logger.Warning("session is not open, %s func is nothing to do, please check config.toml", funcName)
//logger.Warning("session is not open, %s func is nothing to do, please check config.toml", funcName)
return
}