feat(be/fe): enable captcha (#69)
* feat(ui): enable captcha * feat(server): enable captcha * fix(ui): fix login pane layout * fix(config): remove unused config and files * fix(be/fe): clean up code * chore(fe/be): clean up code
This commit is contained in:
parent
021e5090be
commit
1fcb2223a0
22 changed files with 262 additions and 82 deletions
|
@ -17,6 +17,9 @@ type UsersCfg struct {
|
|||
CookieHttpOnly bool `json:"cookieHttpOnly" yaml:"cookieHttpOnly"`
|
||||
MinUserNameLen int `json:"minUserNameLen" yaml:"minUserNameLen"`
|
||||
MinPwdLen int `json:"minPwdLen" yaml:"minPwdLen"`
|
||||
CaptchaWidth int `json:"captchaWidth" yaml:"captchaWidth"`
|
||||
CaptchaHeight int `json:"captchaHeight" yaml:"captchaHeight"`
|
||||
CaptchaEnabled bool `json:"captchaEnabled" yaml:"captchaEnabled"`
|
||||
}
|
||||
|
||||
type Secrets struct {
|
||||
|
@ -60,6 +63,9 @@ func DefaultConfig() (string, error) {
|
|||
CookieHttpOnly: true,
|
||||
MinUserNameLen: 4,
|
||||
MinPwdLen: 6,
|
||||
CaptchaWidth: 256,
|
||||
CaptchaHeight: 60,
|
||||
CaptchaEnabled: true,
|
||||
},
|
||||
Secrets: &Secrets{
|
||||
TokenSecret: "",
|
||||
|
|
|
@ -189,6 +189,10 @@ func initHandlers(router *gin.Engine, cfg gocfg.ICfg, deps *depidx.Deps) (*gin.E
|
|||
rolesAPI.DELETE("/", userHdrs.DelRole)
|
||||
rolesAPI.GET("/list", userHdrs.ListRoles)
|
||||
|
||||
captchaAPI := v1.Group("/captchas")
|
||||
captchaAPI.GET("/", userHdrs.GetCaptchaID)
|
||||
captchaAPI.GET("/imgs", userHdrs.GetCaptchaImg)
|
||||
|
||||
filesAPI := v1.Group("/fs")
|
||||
filesAPI.POST("/files", fileHdrs.Create)
|
||||
filesAPI.DELETE("/files", fileHdrs.Delete)
|
||||
|
|
|
@ -18,7 +18,8 @@ func TestConcurrency(t *testing.T) {
|
|||
"users": {
|
||||
"enableAuth": true,
|
||||
"minUserNameLen": 2,
|
||||
"minPwdLen": 4
|
||||
"minPwdLen": 4,
|
||||
"captchaEnabled": false
|
||||
},
|
||||
"server": {
|
||||
"debug": true
|
||||
|
|
|
@ -21,7 +21,8 @@ func TestFileHandlers(t *testing.T) {
|
|||
"users": {
|
||||
"enableAuth": true,
|
||||
"minUserNameLen": 2,
|
||||
"minPwdLen": 4
|
||||
"minPwdLen": 4,
|
||||
"captchaEnabled": false
|
||||
},
|
||||
"server": {
|
||||
"debug": true
|
||||
|
|
|
@ -19,7 +19,8 @@ func TestUsersHandlers(t *testing.T) {
|
|||
"users": {
|
||||
"enableAuth": true,
|
||||
"minUserNameLen": 2,
|
||||
"minPwdLen": 4
|
||||
"minPwdLen": 4,
|
||||
"captchaEnabled": false
|
||||
},
|
||||
"server": {
|
||||
"debug": true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue