1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-07-19 17:49:39 +02:00

chore: failed authentication attempts are not errors and are displayed at the log info level (#8524)

I think those are not errors but simple info messages for admins.

I saw them a lot in my logs when no auth was passed to the api calls.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8524
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-committed-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
Michael Kriese 2025-07-16 14:17:06 +02:00 committed by Earl Warren
parent 1695ff8125
commit 93f029cb75
2 changed files with 2 additions and 2 deletions

View file

@ -117,7 +117,7 @@ func verifyAuth(r *web.Route, authMethods []auth.Method) {
var err error var err error
ctx.Doer, err = authGroup.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session) ctx.Doer, err = authGroup.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session)
if err != nil { if err != nil {
log.Error("Failed to verify user: %v", err) log.Info("Failed to verify user: %v", err)
ctx.Error(http.StatusUnauthorized, "authGroup.Verify") ctx.Error(http.StatusUnauthorized, "authGroup.Verify")
return return
} }

View file

@ -117,7 +117,7 @@ func webAuth(authMethod auth_service.Method) func(*context.Context) {
return func(ctx *context.Context) { return func(ctx *context.Context) {
ar, err := common.AuthShared(ctx.Base, ctx.Session, authMethod) ar, err := common.AuthShared(ctx.Base, ctx.Session, authMethod)
if err != nil { if err != nil {
log.Error("Failed to verify user: %v", err) log.Info("Failed to verify user: %v", err)
ctx.Error(http.StatusUnauthorized, ctx.Locale.TrString("auth.unauthorized_credentials", "https://codeberg.org/forgejo/forgejo/issues/2809")) ctx.Error(http.StatusUnauthorized, ctx.Locale.TrString("auth.unauthorized_credentials", "https://codeberg.org/forgejo/forgejo/issues/2809"))
return return
} }