anyx / LoginGateBundle

59 stars 23 forks source link

Filter by username only if defined #27

Closed lexthink closed 3 years ago

lexthink commented 3 years ago

In AuthenticationFailureEvent handler, LoginFormUsernameResolver returns the parameter _username in the request, this value is inserted into the database. But in all other requests, this parameter may not exist, so canLogin method in BruteForceChecker always returns true because FailureLoginAttemptRepository filters records with null username.

I think FailureLoginAttemptRepository should filter by ip and username only if username is defined, if not, filter by ip only.