Skip to content

Different usernames not allowed when correct user credentials applied, after some of wrong credentials with particular username password #430

Answered by nfriedly
MohamedNashad asked this question in Q&A
Discussion options

You must be logged in to vote

For the main issue, I think I see what's happening: skipSuccessfulRequests only works for IPs that aren't already blocked. Once the IP is blocked, it doesn't get to the point where it can evaluate the credentials.

You could add a custom keyGenerator() that takes the username into account, but I wouldn't recommend it, as it would leave you vulnerable to certain forms of attack (e.g. try a whole bunch of different username & password combos from a leaked database.)

Ultimately, I think you should just accept that once an IP is blocked for too many invalid username/password combos, they stay blocked until the timer expires.


Also, just as an aside, this code will set the max and windowMs valu…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nfriedly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants