diff options
author | David Schneiderbauer <daviian@users.noreply.github.com> | 2017-08-24 07:57:54 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-08-24 08:57:54 +0300 |
commit | 174255e74ee2c07e685913ab8bce08fc046569f0 (patch) | |
tree | 2da6d5428c691b6b8a377f4887cdcfb7003ac779 /routers/user | |
parent | 233bbcfa94af8d29c337e0b6602a1991009dde46 (diff) | |
download | gitea-174255e74ee2c07e685913ab8bce08fc046569f0.tar.gz gitea-174255e74ee2c07e685913ab8bce08fc046569f0.zip |
Log failed authentication attempts with remote address for fail2ban (#2334)
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
Diffstat (limited to 'routers/user')
-rw-r--r-- | routers/user/auth.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go index b2caba0bb1..eb41e2f994 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -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) } |