Skip to content

Commit 6a37036

Browse files
log error when login failed (go-gitea#13903)
Co-authored-by: techknowlogick <[email protected]>
1 parent abb9cff commit 6a37036

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

routers/user/auth.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,20 +174,20 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
174174
if err != nil {
175175
if models.IsErrUserNotExist(err) {
176176
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplSignIn, &form)
177-
log.Info("Failed authentication attempt for %s from %s", form.UserName, ctx.RemoteAddr())
177+
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
178178
} else if models.IsErrEmailAlreadyUsed(err) {
179179
ctx.RenderWithErr(ctx.Tr("form.email_been_used"), tplSignIn, &form)
180-
log.Info("Failed authentication attempt for %s from %s", form.UserName, ctx.RemoteAddr())
180+
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
181181
} else if models.IsErrUserProhibitLogin(err) {
182-
log.Info("Failed authentication attempt for %s from %s", form.UserName, ctx.RemoteAddr())
182+
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
183183
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
184184
ctx.HTML(200, "user/auth/prohibit_login")
185185
} else if models.IsErrUserInactive(err) {
186186
if setting.Service.RegisterEmailConfirm {
187187
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
188188
ctx.HTML(200, TplActivate)
189189
} else {
190-
log.Info("Failed authentication attempt for %s from %s", form.UserName, ctx.RemoteAddr())
190+
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
191191
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
192192
ctx.HTML(200, "user/auth/prohibit_login")
193193
}

0 commit comments

Comments
 (0)