? ? Success

User tests: Successful: Unsuccessful:

avatar dziudek
dziudek
21 Mar 2016

Pull Request for Issue #9500.

Summary of Changes

I've added + instead of * in the regexp, so now after setting the tld param at least one domain is required in the e-mail.

Testing Instructions

The regexps was the same so the tld param was not working for e-mail validation.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar dziudek dziudek - open - 21 Mar 2016
avatar dziudek dziudek - change - 21 Mar 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Mar 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 21 Mar 2016
Category Libraries
avatar infograf768
infograf768 - comment - 21 Mar 2016

Tests don't work and for a good reason: this patch prevents mails of the type maymail@localhost

The general result is: Address is valid for SMTP but has unusual elements

The specific diagnosis is: Address is valid but at a Top Level Domain

Here is the relevant passage from the email RFCs:

In the case of a top-level domain used by itself in an email address, a single string is used without any dots. This makes the requirement, described in more detail below, that only fully-qualified domain names appear in SMTP transactions on the public Internet, particularly important where top-level domains are involved. 

RFC 5321 section 2.3.5
http://tools.ietf.org/html/rfc5321#section-2.3.5

avatar dziudek
dziudek - comment - 21 Mar 2016

@infograf768 - ok, but what is the sense of existence for the tld param? As you can see before my change the regex property contains exactly the same regular expression. I thought that tld option enables a check for the tld domain in the e-mail.

avatar roland-d
roland-d - comment - 1 Aug 2016

@dziudek I agree with you, this change is valid. If the field is set to check for a TLD it should check for a TLD. Since this file has been updated in the meantime, can you check if it works with the current staging version of Joomla?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9501.

avatar dziudek
dziudek - comment - 2 Aug 2016

@roland-d - as I see the following change: 98c48ee doesn't fix the issue - I've checked it in http://regexr.com/

for test case:

test@gmail
test@gmail.com

The current regexp accepts both mails, when it should accept only the second one. And my change - replacing *$ into +$ at the end still helps :)

avatar roland-d
roland-d - comment - 2 Aug 2016

@dziudek Thank you for checking. Could you update this pull request with the current codebase and your fix? I can have this tested after that. Thanks.

avatar dgt41
dgt41 - comment - 2 Aug 2016

@roland-d I think this is covered with #10760 as we now use the code from w3c for that part

avatar dgt41
dgt41 - comment - 2 Aug 2016

Also what @infograf768 wrote above is right, so both cases are valid:

test@gmail
test@gmail.com
avatar roland-d
roland-d - comment - 2 Aug 2016

@dgt41 No, I disagree that both cases are valid. If the XML definition states that the TLD is required we must check for it. If the TLD requirement is not set, then we should allow both cases.

As for the W3C query, yes it is valid for both cases but not if the TLD is required.

avatar dgt41
dgt41 - comment - 2 Aug 2016

@roland-d so how do you set the XML to require a TLD?

<field name="email" type="email"
    label="JGLOBAL_EMAIL"
    description="COM_ADMIN_USER_FIELD_EMAIL_DESC"
    required="true"
    size="30"
    class="inputbox"
    validate="email" />

Never mind I was using the documentation which doesn;t mention the tld... Nice!

avatar roland-d
roland-d - comment - 2 Aug 2016
avatar dziudek
dziudek - comment - 2 Aug 2016

@roland-d - I've just updated the codebase and applied the change with replacing replacing *$ into +$

avatar roland-d
roland-d - comment - 2 Aug 2016

@dziudek Thanks for that. There seems to be conflicts still, can you check and fix them? Thank you.

avatar dziudek
dziudek - comment - 2 Aug 2016

@roland-d - I've updated the codebase in my repository and now it should be ok.

avatar roland-d
roland-d - comment - 2 Aug 2016

@dziudek Indeed it's looking good and Travis is running. Let's hope Travis will be a nice boy :) Now people can test it again.

avatar brianteeman
brianteeman - comment - 3 Aug 2016

Travis isnt happy with this ;(


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9501.

avatar roland-d
roland-d - comment - 3 Aug 2016

The problem is with the unit test and not with the code. Checking what is going on.

@yvesh Can you help out here please?

avatar mbabker
mbabker - comment - 3 Aug 2016

The failure is testing that test3@localhost passes the check with the tld attribute set and with this patch it's not. If I'm glancing this over correctly, the change mandates a domain.tld structure. So if that's the case, this data set needs to be changed so that false is the expected result since this won't pass since it's missing a TLD. Or if localhost is supposed to be valid on its own even with the tld attribute set then the code needs to be adjusted to account for this special case.

avatar roland-d
roland-d - comment - 3 Aug 2016

@mbabker Yes I came to the same conclusion, just don't know how to change the dataset because the email test3@localhost has a false value set in the dataset.

If you require a tld by specifying that in the XML then localhost shouldn't be allowed I guess unless we decide it's an exception to the rule.

avatar yvesh
yvesh - comment - 3 Aug 2016

I don't think @localhost should be true in the last tld test, looks like there was a bug before.

So only this line needs changes, for the tests to pass.

avatar roland-d
roland-d - comment - 4 Aug 2016

@yvesh Thanks for that. I don't know why but that line had a false argument when I was looking at it yesterday. That got me confused. No idea what I was looking at then :)

@dziudek Can you change the line mentioned by Yvesh and replace true with false and commit that change. We can then see if Travis passes. Thanks.

avatar joomla-cms-bot joomla-cms-bot - change - 4 Aug 2016
Category Libraries Libraries Unit Tests
avatar joomla-cms-bot joomla-cms-bot - change - 4 Aug 2016
Labels Added: ?
avatar dziudek
dziudek - comment - 4 Aug 2016

@roland-d - I've synced the branch with current code base and I've added the updated test code - we will see if now Travis finish it successfully.

avatar roland-d
roland-d - comment - 4 Aug 2016

@dziudek Fingers crossed :)

avatar dziudek
dziudek - comment - 4 Aug 2016

@roland-d - It seems that all is ok - all necessary builds are correct :)

avatar roland-d
roland-d - comment - 4 Aug 2016

@dziudek Yes, persistence is paying off :) Now we need to get some people to test this.

avatar brianteeman
brianteeman - comment - 4 Aug 2016

How to test?

avatar degobbis
degobbis - comment - 6 Aug 2016

I have tested it, now works fine


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9501.

avatar degobbis degobbis - test_item - 6 Aug 2016 - Tested successfully
avatar degobbis
degobbis - comment - 6 Aug 2016

I have tested this item successfully on 278ef93


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9501.

avatar roland-d
roland-d - comment - 11 Aug 2016

To test this, do the following:
1. Modify the file components/com_users/models/forms/registration.xml by adding this line to the email1 field tld="required" or tld="tld" both options work the same. This forces emails to have a TLD specified.
2. Try to register a user with an email me@example
3. Joomla will happily register this user
4. Apply the patch
5. Try to register a user with an email meagain@example
6. This will not be allowed and a message will be shown that the email address is invalid
7. Try to register the user with the mail meagain@example.com
8. User is now registered because a TLD exists.

avatar roland-d roland-d - test_item - 11 Aug 2016 - Tested successfully
avatar roland-d
roland-d - comment - 11 Aug 2016

I have tested this item successfully on 278ef93

Registering a user without a TLD is possible before the patch despite requiring the TLD. After applying the patch an email without TLD cannot be registered if required.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9501.

avatar rdeutz rdeutz - change - 29 Aug 2016
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-08-29 17:30:30
Closed_By rdeutz

Add a Comment

Login with GitHub to post a comment