View Issue Details

IDProjectCategoryView StatusLast Update
0017304phplist applicationSubscribe Processpublic06-07-15 17:04
Reporterdeajan 
PrioritylowSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.0.6 
Target Version3.0.XFixed in Version3.2.0 
Summary0017304: Javascript Email verification process can be done better
DescriptionHello,

On the subscribe page, the script that checks emails can be enhanced with a regular expression checking for email validity like this:

function CheckEmail()
{
  var re = /^(([^<>()[\]\\.,;:\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,}))$/;
    return re.test(document.subscribeform.elements["email"].value);
}

This function can then be called right after compareEmail like this:

  if (! compareEmail()) {
    alert("Email adresses don't match");

    return false;
  }
  
  if (! CheckEmail()) {
    alert("Email format is invalid");
    return false;
  }

Regards,
Ozy.
TagsNo tags attached.

Activities

support

13-08-14 16:29

administrator   ~0054583


The email address is also verified in the PHP code after form submission.

gingerling

20-03-15 15:56

manager   ~0055981

can this just be implemented?

deajan

19-05-15 11:34

reporter   ~0056097

Added PR #15 on github/phplist/phplist3 and PR #7 on github/phplist/phplist-lan-texts

michiel

19-05-15 11:58

manager   ~0056099

Hi deajan, that's great. Would you mind signing the CLA, so I can process the PRs?

https://www.phplist.com/cla