If we enter username and password for the user who doesn't exist in the system it shows below message :-

You have used 0 failed login attempts. You have a limited number of failed login attempts. Once all have been used, your account will be locked.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anurag.s created an issue. See original summary.

dkolarevic’s picture

StatusFileSize
new551 bytes

Maybe the solution is to check if the user exists.

rajdeep0826’s picture

Assigned: Unassigned » rajdeep0826
Issue tags: -
rajdeep0826’s picture

Update the patch with message

jaydub’s picture

Status: Active » Needs review
anybody’s picture

Version: 8.x-1.x-dev » 2.x-dev
Assigned: rajdeep0826 » Unassigned
Status: Needs review » Needs work
Issue tags: +Needs reroll

@rajdeep0826 could you please reroll this against 2.x?

rpayanm made their first commit to this issue’s fork.

rpayanm’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
anybody’s picture

Status: Needs review » Needs work

I commented the MR. This still needs work, but the proposed changes are reducing security, so that's not a good thing.

anybody’s picture

Assigned: Unassigned » grevil
Priority: Major » Normal
Issue tags: +Needs tests

And we should have a test for a non-existent user login try.

The expected result would be that trying to log in as a non-existent user is counted as a wrong login attempt, as it's a possible attack. But the message shown should be correct, of course.
Behind the scenes, it should be handled like a failed login attempt.

@Grevil could you add such a test and have a look at my comments in the MR?

anybody’s picture

anybody’s picture

Related issues:

Grevil made their first commit to this issue’s fork.

grevil’s picture

Behind the scenes, it should be handled like a failed login attempt.

Unfortunately, this is not easily done, but I am on it.

After every login validation, the module checks which attempt settings are activated (soft host, hard host, user), compares the set values with the appropriate login count value (ip_current_count, user_current_count) and blocks them if necessary. Both count attributes are being fetched from the same database "login_security_track", which is created by this module.

Basically, it counts every table rows "host" / "name" entry based on the attempt setting.

Before, these database entries were only created if the typed in user really exists, I fixed this problem, by adding every login attempt to the database table. I hope this won't lead to errors on websites with huge traffic.

Furthermore, I am unsure if this concept really is the best approach... Drupal core's flood control should already have a logging table like this, we should discuss this in #3330627: [META] Improve behaviour with the user module's flood control.

grevil’s picture

FYI, a bunch of tests fail by my changes. For once, the hard blocking still doesn't work and the other tests need further investigation.

grevil’s picture

Status: Needs work » Needs review

All done! Please review.

anybody’s picture

Status: Needs review » Reviewed & tested by the community

Code is fine! Once the tests go green, feel free to merge this.

anybody’s picture

grevil’s picture

Status: Reviewed & tested by the community » Fixed

All tests are green! Merging!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.