Skip to content

Commit 174255e

Browse files
daviianlafriks
authored andcommitted
Log failed authentication attempts with remote address for fail2ban (#2334)
Signed-off-by: David Schneiderbauer <[email protected]>
1 parent 233bbcf commit 174255e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

routers/user/auth.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
154154
if err != nil {
155155
if models.IsErrUserNotExist(err) {
156156
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplSignIn, &form)
157+
log.Info("Failed authentication attempt for %s from %s", form.UserName, ctx.RemoteAddr())
157158
} else if models.IsErrEmailAlreadyUsed(err) {
158159
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), tplSignIn, &form)
160+
log.Info("Failed authentication attempt for %s from %s", form.UserName, ctx.RemoteAddr())
159161
} else {
160162
ctx.Handle(500, "UserSignIn", err)
161163
}

0 commit comments

Comments
 (0)