Skip to content

Commit 64298dc

Browse files
authored
Failed authentications are logged to level Warning (#32016)
PR for issue #31968 Replaces PR #31983 to comply with gitea's error definition Failed authentications are now logged to level `Warning` instead of `Info`.
1 parent 7c6edf1 commit 64298dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

routers/web/auth/auth.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,20 +228,20 @@ func SignInPost(ctx *context.Context) {
228228
if err != nil {
229229
if errors.Is(err, util.ErrNotExist) || errors.Is(err, util.ErrInvalidArgument) {
230230
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplSignIn, &form)
231-
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
231+
log.Warn("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
232232
} else if user_model.IsErrEmailAlreadyUsed(err) {
233233
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), tplSignIn, &form)
234-
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
234+
log.Warn("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
235235
} else if user_model.IsErrUserProhibitLogin(err) {
236-
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
236+
log.Warn("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
237237
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
238238
ctx.HTML(http.StatusOK, "user/auth/prohibit_login")
239239
} else if user_model.IsErrUserInactive(err) {
240240
if setting.Service.RegisterEmailConfirm {
241241
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
242242
ctx.HTML(http.StatusOK, TplActivate)
243243
} else {
244-
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
244+
log.Warn("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
245245
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
246246
ctx.HTML(http.StatusOK, "user/auth/prohibit_login")
247247
}

0 commit comments

Comments
 (0)