Repository navigation
Move validate email address to page rather than in global roller.js #243
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
Open
gregh3269
wants to merge
3
commits into
apache:roller-6.1.x
Choose a base branch
from
gregh3269:roller-6.1.x-fix-email-validation-location
base: roller-6.1.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This regex was here before, but since it's moving:
[A-Z]{2,4}rejects valid addresses with longer TLDs, such asuser@example.museum,user@studio.photographyoruser@company.online, so those users can't create a weblog. Its maxlength of 255 also doesn't match the field's maxlength of 50. jQuery Validate'semail: truealready validates the format, so dropping the regex rule (or allowing TLDs of 2-63 characters) would fix it.Uh oh!
There was an error while loading. Please reload this page.
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.
As a test I updated the regex from roller.js validateEmail
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/It works but now gets rejected up stream.
So I guess it never worked. For simplicity just drop the client validation, and fix up steam.
But its a struts issue
`
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.
Thanks for testing that. Good find that the server-side validator is the one rejecting long TLDs. I looked at the Struts 7.3.0 jar Roller ships:
EmailValidatorsets its pattern to end in([a-z]{2,6}), so anything longer than six letters fails there. Dropping the client regex makes sense to me, as long as the server check stays.EmailValidatorextendsRegexFieldValidator, so a<param name="regex">on the field-validator should let Roller use a looser pattern without waiting on Struts. I haven't tried that. Fine as a follow-up.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.
One more data point for this:
roller.jsalready has avalidateEmail()helper (around line 211) thatRegister.jsp,Profile.jspandUserEdit.jspuse, and it accepts long TLDs. So today someone can register asjane@studio.photographyand then fail this check when creating a weblog. If the regex rule goes,email: truewithminlengthcovers the same ground and keeps the two forms consistent.