Problem/Motivation
PasswordPolicyValidatorInterface::validatePassword() is documented to return PasswordPolicyValidationReport, while PasswordPolicyValidator::validatePassword() returns TRUE when the password is too long.
/**
* @return \Drupal\password_policy\PasswordPolicyValidationReport
* Validation report object.
*/
public function validatePassword(string $password, UserInterface $user, array $edited_user_roles = []): PasswordPolicyValidationReport;
/**
* {@inheritdoc}
*/
public function validatePassword(string $password, UserInterface $user, array $edited_user_roles = []): PasswordPolicyValidationReport {
// Stop before policy-based validation if password exceeds maximum length.
if (strlen($password) > PasswordInterface::PASSWORD_MAX_LENGTH) {
return TRUE;
}
Proposed resolution
Change the @return line in the interface.
Comments
Comment #3
ivanhelguera commentedComment #4
ivanhelguera commentedComment #5
ivanhelguera commentedComment #6
avpadernoComment #7
hmendes commentedThanks for the MR. Changing this to RTBC.
Comment #9
rajeshreeputra+1 RTBC, rebased
Comment #10
avpadernoComment #12
avpadernoThe description is missing a indefinite article before Validation report and a definite article before password exceeds.
Comment #14
urvashi_vora commentedHi @apaderno,
I have added the indefinite and definite article and committed the changes, also I have rebased the branch.
Please review the changes.
Thanks
Comment #15
avpadernoThe lat MR is correct.
Comment #16
kristen polAssigning to myself as I'm reviewing/merging ready RTBC fixes/updates over the next few days.
Comment #17
kristen polThanks everyone for working on this issue.
I'm surprised that the code returns TRUE in the first place as I would expect it to return FALSE if it doesn't validate properly. But, this issue isn't trying to address that... it's just updating the documentation.
The change seems okay to merge, so I will.
Comment #19
kristen polThe fix has been merged and will be part of the next release.
Comment #20
kristen polThis was against 4.0.x as 8.x branches are no longer supported, so changing version.
Comment #22
kristen polThis is part of the new 4.0.1 release.