Problem/Motivation

When logging in if an incorrect password is entered it it sent to API to check if it has been compromised.
There should be a setting to allow only sending the password to the API if the login attempt was successful.

Steps to reproduce

Login with a correct username and a wrong password, but that wrong password appears on the pwned list.
E.g. admin and password.
A warning is shown even though the user supplied a incorrect password and has not been logged in.

Proposed resolution

Add setting for "Check failed login attempts?"
Help text to read "Should the password be checked when the login attempt fails? (Default: True)"

Remaining tasks

Implement the suggested changes.

User interface changes

Update admin page with new setting.

API changes

None.

Data model changes

None.

Comments

dahousecat created an issue. See original summary.

dahousecat’s picture

Title: Only validate password for sucsesful login attempts » Only validate password for successful login attempts
dahousecat’s picture

dahousecat’s picture

Updated patch to delete the `password_haveibeenpwned_check_failed_login` variable during uninstall.

mcdruid’s picture

Status: Active » Needs work
Issue tags: +Needs tests
StatusFileSize
new2.36 KB
new3.24 KB

Thanks, this is a good idea.

I've tweaked the patch slightly; I think this should default to no/false/off, and the other boolean option in the admin form uses a checkbox rather than radios.

I'd also like tests before this is committed; with any luck they shouldn't be too hard to add based on those we already have.

mcdruid’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new2.21 KB
new5.53 KB

Here's a couple of basic tests.

These reveal the fact that with the "check_failed_login" option enabled, the module may emit messages saying:

Your current password appears in ...

...when it wasn't really the current, stored password that was checked.

I don't think this is an especially big deal, but we could tweak that wording.

  • mcdruid committed bba23f36 on 7.x-2.x authored by dahousecat
    Issue #3330749 by mcdruid, dahousecat: Only validate password for...
mcdruid’s picture

Status: Needs review » Fixed

Tweaked the wording of messages a little depending on whether this new option is set.

Thanks for the patch; definitely an improvement!

Status: Fixed » Closed (fixed)

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