Problem/Motivation
When the same mailbox requests to recover the password 5 times, it will prompt Password reset form was submitted with an unknown or inactive account: test@drupal.com.. But the user is actually locked. This problem needs to be debugged to find out, and will not directly prompt the user to be locked
Steps to reproduce
- install new drupal 9 latest
- login and goto /admin/people/create create user, username and email is test@drupal.com and set active
- logout and go to /user/password enter email test@drupal.com 5 times
- will now prompt: If test@drupal.com is a valid account, an email will be sent with instructions to reset your password.the truth is that this mailbox has been blocked
Proposed resolution
We should tell the user that this email is locked. Instead of other prompts
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #51 | interdiff_48-51.txt | 1.84 KB | sourabhjain |
| #51 | 3353185-51.patch | 3.49 KB | sourabhjain |
| #48 | interdiff_45-48.txt | 1.88 KB | sourabhjain |
| #48 | 3353185-48.patch | 3.54 KB | sourabhjain |
| #45 | Screenshot-3353185.png | 239.69 KB | nikhil_110 |
Comments
Comment #2
xiukun.zhou commentedComment #3
xiukun.zhou commentedComment #4
avpadernoAn issue summary needs to describe what the bug is and provide any information necessary to replicate the issue on a plain Drupal site.
Also, looking at the provided patch, this does not seem a bug report.
Comment #5
avpadernouser.password_request_user is not a limit per IP, but per user. The Too many password recovery requests from your IP address. message is wrong; it should say the user has done too many password recovery requests.
Comment #6
xiukun.zhou commentedthanks apaderno
i will update summary.
Comment #7
xiukun.zhou commentedComment #8
xiukun.zhou commentedComment #9
xiukun.zhou commentedfix message
Comment #10
cilefen commentedComment #11
xiukun.zhou commentedComment #12
dpiThere is no concept of locking in core. Please update the issue to use 'blocked'/'blocking'/'active' where appropriate.
Grammar nits.
Its not 'from' your account, it would be 'for', as the user is presumably not authenticated as this account.
And we do not know it is 'your' account, use 'this', as we do not know the user owns this account. This contrasts to the IP address language this message was likely based from, where we can roughly confirm it is 'your IP address'.
Needs tests.
Comment #13
xiukun.zhou commentedhi dpi
the flood check identifier is a user account id. so not ip address
Comment #14
smustgrave commentedWas tagged for issue summary update and tests which still need to happen.
For the issue summary if stuck would recommend using the default template for issues.
Comment #15
xiukun.zhou commentedupdate new patch name and fix message
Comment #16
xiukun.zhou commentedComment #17
smustgrave commentedTicket was tagged for issue summary update and test both which still appear needed. Thanks
Comment #18
xiukun.zhou commentedComment #19
xiukun.zhou commentedthanks smustgrave
The summary and test steps have been updated
Comment #20
smustgrave commentedThanks but need an actual test case or assertion in the code.
Comment #21
xiukun.zhou commentedadd test case.
Comment #22
xiukun.zhou commentednew patch
Comment #23
xiukun.zhou commentedComment #24
smustgrave commentedThanks. FYI you don't have to run all the tests just the default one is fine.
Also all patches should be attached with an interdiff.
So way the functional tests work each method is it's own bootstrap and install. So could this be converted to kernel tests? If not could they be added to existing tests? At minimum should combine these two
Comment #25
xiukun.zhou commentedI referred to two methods
File: core/modules/user/tests/src/Functional/UserPasswordResetTest.php
i think this can be add to kernel test
There is an attach interdiff file below. thanks smustgrave
Comment #27
xiukun.zhou commentedComment #28
smustgrave commentedIf you were trying to upload a test only patch should also include the full patch.
Wording for the patch should also change.
Typically [issue-number]-[optional:summary]-[comment-number].patch
Tests only patches will be [issue-number]-[optional:summary]-[comment-number]-tests-only.patch
Comment #29
xiukun.zhou commentedUploaded all patches again
Comment #30
prasanth_kp commentedI have applied the #29 patch on 9.5.x dev version and it works fine .
Comment #31
xiukun.zhou commentedComment #32
avpadernoThe person who provided the patch cannot change status to Reviewed & tested by the community.
Comment #33
avpadernoIt is temporarily blocked. should be about the account, but the previous sentence ends with for this username or email, which makes it a substitution for this username or email.
Comment #34
nikhil_110 commentedI have added patch for Drupal 9.5.x and address #33..
please review..
Comment #35
nikhil_110 commentedFixed #34 Cc Failed
Comment #36
avpadernoComment #37
mrinalini9 commentedFixing custom command failure issues in #35, please review it.
Thanks!
Comment #39
xiukun.zhou commentedComment #40
xiukun.zhou commentedComment #41
zeeshan_khan commentedComment #42
nikhil_110 commentedI fixed issue #41 Please review
Comment #43
avpadernoIt is preferable to say The account has been temporarily blocked. Otherwise the sentence would be understood as This username or email is temporarily blocked. which does not make much sense since it is the account that is blocked.
I find it preferable to say Too many password recovery requests for %name.
Comment #44
smustgrave commentedAgree with #43
Comment #45
nikhil_110 commentedI have updated the patch with latest update suggested by user @apaderno and user @smustgrave, I would appreciate if someone can review these updates and provide feedback
Comment #46
avpadernoThe suggested words for the first sentence were Too many password recovery requests for %name.
Actually, to make it a sentence, the words should be Too many password recovery have been requested for %name. In this case, the next sentence should be The account is temporarily blocked. (just to avoid to use the Present Perfect twice in row).
Comment #47
sourabhjainLet me work on the #46
Comment #48
sourabhjainI have fixed the #46 issue. Please review.
Comment #49
avpadernoI apologize if what I suggested was not clear: The string passed to
$this->t()(ort()) needs to contain the following text (and only this).Comment #50
sourabhjainComment #51
sourabhjainI have fixed the #49 issue. Please review.
Comment #52
avpadernoThe patch is fine for me. Let us wait for somebody else's opinion.
Comment #53
jan kellermann commentedYou cannot write "The account has been temporarily blocked." because then you say that this account exists and you have a privacy data breach!
But this means you have to count the password-requests for every mail address - regardless of whether this account exists or not. If you count only the requests for existing accounts a malicious robot can examine which user accounts exists or not. Imagine this e.g. for a HIV/AIDS Selfhelp portal!
Please be careful with such information to avoid an information disclosure and a privacy violation.
Comment #54
smustgrave commentedAgreed will have to tweak the language
Comment #55
avpadernoIn that case, the message should not even say Too many password recovery have been requested for %name. because that could possibly give information about the account.
Imagine I tried once a password recovery using a username or an email and I got that message. I would gather that somebody else tried to recover the password using the same username or email, which could make me think the username or the email is effectively used (or that trying that username/email is a common practice for somebody who tries to find out which accounts exist on a site). If then I know the site considers attempts made from the same IP address, and I am at my work place, that message could help me to guess username or email used by a colleague.
To avoid giving information about existing accounts, the message should be the same in any case, whether the username/email is not associated to any account, too many attempts have done, or the username/email is associated with an account and the recovery email has been sent. For example, showing this message in every case would not allow to understand if the username/email is effectively associated with an account.
Comment #56
jan kellermann commentedWe may (optionally) consider sending an email when an account is suspended.
Then we have no information disclosure and the account is informed that someone tried something bad and can inform the administrator.
Comment #57
avpadernoActually, the account for which the password recovery is asked is never blocked. The code in
UserPasswordForm.phpincreases the number of requests done to recover the password; that eventually avoids further password recovery requests can be done.This means that the The account is temporarily blocked. part is wrong. Taking off that part, the message would be Too many password recovery have been requested for %name. Try again later or contact the site administrator. which could still give out information about a possible account.
As for sending an email when the number of password recovery requests reached the limit, that would mean flooding the account's email address with a new email each time a new password recovery request is done after the limit is reached.
An email is already sent to the account's email address for the password recovery, and that email says:
Eventually, that email message should also contain a sentence that explains what to do when the person who is reading the email did not request the password recovery (If you did not request a password recovery […].).
Comment #58
atul4drupal commentedOne suggestion that I think of to frame the error message considering all the constraints and concerns raised in the thread is :
"If {account ID} is a valid and active account, an email will be sent with instructions to reset your password."
account ID will be the value entered by user in "username or Email" field.
Kindly share thoughts on using this... or some thing on this line.
Comment #59
ressaIn case you find this issue trying to figure out what "Password reset form was submitted ..." means, and realize you need to clear the
floodtable, you can do it with this:drush sql:query "DELETE FROM flood;".Comment #60
poker10 commentedRe: #58
I am not sure if this is entirely correct. Account under flood control is active and its status is not "blocked", as mentioned by @apaderno in #57. So we are missing at least one possible scenario in the proposed text.
The idea with sending an email to user from #56 is interesting, however I think we would need to ensure that the email is sent only once. Otherwise it would be possible to spam user with such emails.