-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand occ user reset password email validation #32569
Expand occ user reset password email validation #32569
Conversation
Previously, when calling occ user:resetpassword --send-email, if the email address was null, then an error would be shown on the console, but not if the password was empty. So this commit extends the email address validation to show the error if the email address is null or empty.
zend-validator provides a well written and tested library for validation. I specifically added it so that I could perform better email address validation in ResetPasswordTest::hasValidEmailAddress.
I refactored the existing email address validation, which only tests if the email address is a null or an empty string, to use Zend\Validator\EmailAddress. By doing so, the email address can be tested far more exhaustively than it is, currently.
Codecov Report
@@ Coverage Diff @@
## master #32569 +/- ##
============================================
+ Coverage 64.09% 64.1% +<.01%
- Complexity 18654 18655 +1
============================================
Files 1177 1177
Lines 70232 70234 +2
Branches 1270 1270
============================================
+ Hits 45018 45020 +2
Misses 24844 24844
Partials 370 370
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@settermjd please backport |
@settermjd did a backport happen? |
@settermjd @PVince81 I don't see any backport for this??? |
Backport |
Thanks for backporting @phil-davis. |
@settermjd Those are the options available for user:resetpassword command
In the OP it says run command |
Description
Improves the email address validation performed when running
occ user:resetpassword --email-link
.Related Issue
Motivation and Context
When I was documenting the changes that #32345 made, I found that when running
occ user:resetpassword --email-link
, an error message is displayed only if a user's password isnull
. However, if it was an empty string, then the error would not be thrown and the code would attempt to send an email using the invalid email address.I created these changes to ensure that only valid email addresses are able to be used.
💁 fwiw, I'm not totally sure that using a Zend\Validator\EmailAddress object directly is the best approach.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Open tasks: