fix: improve login error handling for invalid credentials
This commit is contained in:
parent
4ccfa629cc
commit
08d98aaeca
1 changed files with 2 additions and 1 deletions
|
|
@ -630,7 +630,8 @@ func (s *Service) RegisterAccount(ctx context.Context, company *domain.Company,
|
|||
func (s *Service) Authenticate(ctx context.Context, username, password string) (string, time.Time, error) {
|
||||
user, err := s.repo.GetUserByUsername(ctx, username)
|
||||
if err != nil {
|
||||
return "", time.Time{}, err
|
||||
// Return generic error to avoid leaking DB details or user existence
|
||||
return "", time.Time{}, errors.New("invalid credentials")
|
||||
}
|
||||
|
||||
if err := bcrypt.CompareHashAndPassword([]byte(user.PasswordHash), []byte(s.pepperPassword(password))); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue