-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fixes email validation regular expressions #7005
Conversation
This fixes regular expressions used for email validation (see: joomla#6982)
@zero-24 (I suppose...) Thanks for fixing my initial comment! |
oops... |
hopefully...
I guess...
nope... it doesn't work: problem in validate.js. Working on it, please stand-by... sorry! |
Ready for testing. Sorry for the initial (hopfully...) f##k-up. |
I tried to add a new user in backend and frontend. Tested emails
Result is Error Warning I think it's the PHP validation because page reloads after form submit and then message occurs. |
@bertmert |
btw... where are you testing? I tested in com_contacts... |
silly me: you already stated where you are testing! let me try... |
You're right: it doesn' work with com_users (it works with com_contacts, anyway...) I have to find out the reason, but now I'm leaving for some hours. Please stand-by... |
even in |
I'll send you a PR to branch .smz:EmailValidation. There's another validation in libraries/joomla/mail/helper.php::isEmailAddress line 130
called by libraries/joomla/table/user.php::check line 198 Changed line to
and all works now. |
See comment please: joomla#7005 (comment)
I see BC issue: We should add new allowed char (single quote) to patterns but not replace any existing chars. |
Allow apostrophe in com_user emails
@bertmert thanks for your PR for fixing validation in com_users! Merged. (oops... while I'm writing this, I see Travis failed after merging your PR... will look into that...) @Denitz IMHO this is not breaking B/C: this is fixing a bug introduced by someone who used the wrong apostrophe (my bet is that he/she was using a Mac while editing...). Try register an email address containing the grave accent char |
Travis is failing because of this:
IMHO it is a mistake in test unit (same mistake we had in code). |
Some further considerations (food for thought...):
|
More information: The HTML5 standard defines the rule for validating the
According to the standard itself, the above is not a strict implementation of the relevant RFC5322:
I think the more sensible solution for us is to follow the HTML5 standard and implemant the same validation rules. This is, I guess, particullay true for A further consideration is that we should be consistent with that (or any other) validation rule: if we use a rule in our JS code, we cannot use a different rule in our PHP code. Due to the above, I will soon submit to this PR a commit in line with the above considerations (it will fail with Travis for the same reasons it is failing right now). Also: in If you think there is anything wrong with the above, please let me know... |
I don’t think I agree with that. JS validation is to check (coarse) that an email address is provided and PHP should make sure that this address actually exists etc |
Dimitris, our PHP code has never checked that an address actually exist (not even the domain): it has always done a formal check of the email address, the same as JS does. |
Sergio, I just stated what my personal preference is here. It’s not something that should prevent you from doing you think is best. |
@test works for o’sulivan@yahoo.gr |
@dgt41 Dimitris, does the .gr registry allows domains names in Greek? In case, do you have (or can you create) a mailbox in such a domain (possibly two: one with an ASCII local part and one with a Greek local part)? Thanks! |
@smz Haven’t tried, TBH, give me 5mins to check! |
No prob and no hurry! Take your time... |
@smz Damn all my sites use google, zoho and msn for the mail part. I am gonna need some time for this |
No prob... in case you can, please let me know (direct email, so we don't litter this conversation too much...) |
There were a lot of [space][tab] sequences in it and I converted all of them to [tab]
Correct. Concerning our punycode.js I suggest again to update it and test. |
We do have a Russian test domain (with a joomla site btw) |
So... how can we have the test unit corrected?
I see: I downloaded the latest rev (1.3.2) and now they're doing exactly the same thing I did in validate.js, so there is probably no need for us doing it there. I will test and report. |
@dgt41, @infograf768 As soon as possible I will set up a (Joomla, of course!) site for it and email service (which, for the time being, will not allow UTF8 local parts). I'll keep you informed. |
I dunno how much it helps but there was a long discussion about dealing with validating emails a long time ago joomla/joomla-platform#1833 |
@wilsonge Thanks, interesting reading! And I like what the framework came to:
KISS code, which is normally the best solution... I'll check if it will pass our test corpus... I anyway see a (recurring) mistake in that discussion too: IP addresses, when used in an email address domain-part, must be enclosed within square brackets. Once again: local-part@[192.168.0.1] <-- OK This will be taken as an IP address (Yes, you can have numeric domain names (at least in the .it TLD): I used to have some of those for the telephone company I was working for...) Do we want this to pass? Putting an IP address in the domain-part is something normally done by spammers only... Edit: another possibility to use an IP addresses in email address might be rDNS notation: local-part@1.0.168.192.in-addr.arpa ... but I'm unsure if you can have MX records in rDNS zones... |
@infograf768
Edit: Commited here, now. Deleted my temp branch. |
@smz just update punycode-uncompressed.js to be inline with the other scripts (my take). I guess we can’t take this file out as it will b B/C(?) |
@dgt41, well... we never loaded any *-uncompressed.js file anywhere... I think the worst (an unlikely) can happen is that some 3rd party extensions directly loads punycode.js expecting the minified version and it gets the expanded version instead... At least another JS library in /media/system/js have now the new (and IMHO more logical) naming convention: jquery.Jcrop.min.js |
-uncompressed.js should be loading when in debug mode. But removing it or not is more a PLT decision, so don’t look at me |
ah, really? -uncompressed.js are automatically loaded while in debug mode? I didn't know that, my bad! In this case I will revert my decision and leave filenames unchanged... (we will sooner or later have to do something as we go toward a more automatic method of updating external libraries, composer or whatever...) |
... fixed in my branch, but (as there is no reason to wait) I will now commit it here too.. |
This fixes the handling of IDNA domains in JS validation without need to modify validate.js
Fixed. Thanks @dgt41! |
Oh, cap! merge conflicts... why??? |
validate.js changed recently, do a rebase |
... and html5fallback.js as well... 😒 |
Actually only html5fallback.js was changed. I tried a "git rebase --interactive", but I'm now in deep mud: I have a "DETACHED HEAD", I can't switch branch and I'm stuck without any possibility of doing anything. My editor opened with the following:
... but I don't have the slightest idea of what I should do with that... 😖 |
I managed to abort the rebase, but I now need guidance on how to do it correctly... sorry, guys! |
I closed this as I was unable to resolve conflicts. New PR is #7041 |
This fixes regular expressions used for email validation (see: #6982)
Joomla doesn't allow
'
char in user email, JFormRuleEmail pattern has ` but not 'It is allowed to have an apostrophe ' in the e-mail address by the RF5322 standard as long as it is an ASCII character.
Irish email as example:
o'sullivan@example.com