feat(http): log invalid login attempts (#587)

This commit is contained in:
ze0s 2022-12-28 17:58:26 +01:00 committed by GitHub
parent 0c04c669c7
commit e6c48a5228
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 10 deletions

View file

@ -2,6 +2,7 @@ package database
import (
"context"
"database/sql"
"github.com/autobrr/autobrr/internal/domain"
"github.com/autobrr/autobrr/internal/logger"
@ -63,6 +64,10 @@ func (r *UserRepo) FindByUsername(ctx context.Context, username string) (*domain
var user domain.User
if err := row.Scan(&user.ID, &user.Username, &user.Password); err != nil {
if err == sql.ErrNoRows {
return nil, nil
}
return nil, errors.Wrap(err, "error scanning row")
}