Skip to content

Commit

Permalink
Log failed authentication attempts with remote address for fail2ban (#…
Browse files Browse the repository at this point in the history
…2334)

Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
  • Loading branch information
daviian authored and lafriks committed Aug 24, 2017
1 parent 233bbcf commit 174255e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions routers/user/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
if err != nil {
if models.IsErrUserNotExist(err) {
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplSignIn, &form)
log.Info("Failed authentication attempt for %s from %s", form.UserName, ctx.RemoteAddr())
} else if models.IsErrEmailAlreadyUsed(err) {
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), tplSignIn, &form)
log.Info("Failed authentication attempt for %s from %s", form.UserName, ctx.RemoteAddr())
} else {
ctx.Handle(500, "UserSignIn", err)
}
Expand Down

0 comments on commit 174255e

Please sign in to comment.