Moodle

weblib.php does not allow email with dot before @

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.6
  • Fix Version/s: None
  • Component/s: Administration
  • Labels:
    None
  • Environment:
    Moodle 1.6
  • Affected Branches:
    MOODLE_16_STABLE

Description

Students who have an email address with a dot just before the at-sign, cannot signup.

Here is a world example:
hong-kong-man...@r.vodafone.ne.jp

This is because the regular expression used in the "validate_email" function in "lib/weblib.php" considers such addresses as "invalid".

Suggested solution:
================
Modify the "validate_email" function to the following:

function validate_email($address) {

return (ereg('^[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~.]+'.
'@'.
'[-!#$%&\'*+
/0-9=?A-Z^_`a-z{|}~]
+\.'.
'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
$address));
}

Activity

Hide
Petr Škoda (skodak) added a comment -

http://en.wikipedia.org/wiki/E-mail_address
According to RFC 2822: The character . provided that it is not the first nor last character in the local-part, nor may it appear two or more times consecutively.

My +1 to keep the test as is.

Show
Petr Škoda (skodak) added a comment - http://en.wikipedia.org/wiki/E-mail_address According to RFC 2822: The character . provided that it is not the first nor last character in the local-part, nor may it appear two or more times consecutively. My +1 to keep the test as is.
Hide
Gordon Bateson added a comment -

Thanks for the link.

Unfortunately the three main mobile providers in Japan do not follow the rules, nor are they likely to in the near future.

So from a practical point of view, I think it would be useful to allow the "validate_email()" function to be slightly less rigorous.

How about giving the the Moodle administrator the choice or whether to implement strict or loose email address syntax checking?

Show
Gordon Bateson added a comment - Thanks for the link. Unfortunately the three main mobile providers in Japan do not follow the rules, nor are they likely to in the near future. So from a practical point of view, I think it would be useful to allow the "validate_email()" function to be slightly less rigorous. How about giving the the Moodle administrator the choice or whether to implement strict or loose email address syntax checking?
Hide
Petr Škoda (skodak) added a comment - - edited

+1 for admin option is it is a major problem in some countries, description should include warning so that admins know that this kind of emails may not work everywhere

Show
Petr Škoda (skodak) added a comment - - edited +1 for admin option is it is a major problem in some countries, description should include warning so that admins know that this kind of emails may not work everywhere
Hide
Gordon Bateson added a comment -

Great, that sounds promising!

My +1 for adding an admin option for "loose" or "strict" checking of email address syntax

Show
Gordon Bateson added a comment - Great, that sounds promising! My +1 for adding an admin option for "loose" or "strict" checking of email address syntax
Hide
Thomas Schalow added a comment -

Dear Petr,
Like Gordon, I was also experiencing problems due to the decision of Japanese mobile providers to be unique and violate RFC 2822. The ability of the admin to set this option would be welcome. Otherwise, we will need to modify .php files with every new release.

Show
Thomas Schalow added a comment - Dear Petr, Like Gordon, I was also experiencing problems due to the decision of Japanese mobile providers to be unique and violate RFC 2822. The ability of the admin to set this option would be welcome. Otherwise, we will need to modify .php files with every new release.

People

Vote (5)
Watch (6)

Dates

  • Created:
    Updated: