1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-10-29 08:17:31 -04:00

Log failed authentication attempts with remote address for fail2ban (#2334)

Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
This commit is contained in:
David Schneiderbauer 2017-08-24 07:57:54 +02:00 committed by Lauris BH
parent 233bbcfa94
commit 174255e74e

View File

@ -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)
}