fix possible username enumeration
This commit is contained in:
parent
4e5d554105
commit
d8c4bef3a3
1 changed files with 3 additions and 2 deletions
|
|
@ -111,12 +111,13 @@ func loginHandler(ctx *Context) {
|
||||||
}
|
}
|
||||||
password := ctx.Form("password")
|
password := ctx.Form("password")
|
||||||
if data.User == "" || password == "" {
|
if data.User == "" || password == "" {
|
||||||
ctx.Error("empty user or password")
|
ctx.Error("empty username or password")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
u, err := ctx.Srv.DB.Login(data.User, password)
|
u, err := ctx.Srv.DB.Login(data.User, password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(err)
|
log.Println("login:", data.User, err)
|
||||||
|
ctx.Error("bad username or password")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if u.Secret == "" {
|
if u.Secret == "" {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue