Joomla users with email domains longer than 4 letters

General questions relating to Joomla! 2.5. Note: All 1.6 and 1.7 releases have reached end of life and should be updated to 2.5. There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Locked
dreamdest
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 21, 2014 6:12 pm

Joomla users with email domains longer than 4 letters

Post by dreamdest » Tue Oct 21, 2014 6:15 pm

We have joomla users who have a .travel domain for their email, and when I go to the user manager--> add new user, it considers the email invalid. It seems that it will allow only up to a 4 characters domain. Does anyone know which file contains the code where I can change this?

Thanks

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 24986
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Joomla users with email domains longer than 4 letters

Post by pe7er » Tue Oct 21, 2014 8:47 pm

I tried to reproduce this behavior in Joomla 3.3.6,
and there you can use email addresses like [email protected] without errors.

Which version do you use? The latest Joomla 2.5.27?
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

dreamdest
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 21, 2014 6:12 pm

Re: Joomla users with email domains longer than 4 letters

Post by dreamdest » Tue Oct 21, 2014 8:51 pm

Yes 2.5.27

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 24986
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Joomla users with email domains longer than 4 letters

Post by pe7er » Tue Oct 21, 2014 9:01 pm

dreamdest wrote:Does anyone know which file contains the code where I can change this?
In Joomla 2.5 the email validation is defined in
/libraries/joomla/form/rules/email.php

Code: Select all

class JFormRuleEmail extends JFormRule
{
	/**
	 * The regular expression to use in testing a form field value.
	 *
	 * @var    string
	 * @since  11.1
	 */
	protected $regex = '^[\w.-]+(\+[\w.-]+)*@\w+[\w.-]*?\.\w{2,4}$';
I am not an expert in regex, but I think it specifies that a domain name should end with a TLD with 2 to 4 characters.

In Joomla 3.3.6 the email validation looks different
/libraries/joomla/form/rule/email.php

Code: Select all

class JFormRuleEmail extends JFormRule
{
	/**
	 * The regular expression to use in testing a form field value.
	 *
	 * @var    string
	 * @since  11.1
	 * @see    http://www.w3.org/TR/html-markup/input.email.html
	 */
	protected $regex = '^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$';
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

dreamdest
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 21, 2014 6:12 pm

Re: Joomla users with email domains longer than 4 letters

Post by dreamdest » Tue Oct 21, 2014 9:19 pm

I changed it to {2,6} and it still doesn't work :(

User avatar
pe7er
Joomla! Master
Joomla! Master
Posts: 24986
Joined: Thu Aug 18, 2005 8:55 pm
Location: Nijmegen, Netherlands
Contact:

Re: Joomla users with email domains longer than 4 letters

Post by pe7er » Tue Oct 21, 2014 9:29 pm

I've created a bug report about it in Joomla's issue tracker:
http://issues.joomla.org/tracker/joomla-cms/4891
Kind Regards,
Peter Martin, Global Moderator
Company website: https://db8.nl/en/ - Joomla specialist, Nijmegen, Netherlands
The best website: https://the-best-website.com

User avatar
dhuelsmann
Joomla! Master
Joomla! Master
Posts: 19659
Joined: Sun Oct 02, 2005 12:50 am
Location: Omaha, NE
Contact:

Re: Joomla users with email domains longer than 4 letters

Post by dhuelsmann » Tue Oct 21, 2014 11:16 pm

There are several places to change this code to ensure it works for your issue:
It is a javascript validation in /public_html/media/system/js/validate-uncompressed.js

Code: Select all

this.setHandler('email',
         function (value) {
            regex=/^[a-zA-Z0-9._-]+(\+[a-zA-Z0-9._-]+)*@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
            return regex.test(value);
Change the {2,4} to {2,8} to accommodate your email TLD. You will also have to find that in the compressed version validate.js (a little more difficult) and change it.

Do the same in /public_html/libraries/joomla/form/rules/email.php

Code: Select all

protected $regex = '^[\w.-]+(\+[\w.-]+)*@\w+[\w.-]*?\.\w{2,4}$';
The above info came from this tracker item http://joomlacode.org/gf/project/joomla ... m_id=28128

Unfortunately, the change in the regex they made did not fix it.
Regards, Dave
Past Treasurer Open Source Matters, Inc.
Past Global Moderator
http://www.kiwaniswest.org


Locked

Return to “General Questions/New to Joomla! 2.5”