se-edu/addressbook-level3

Missing/incorrect exception handling and error message for validity check of email address format

Closed this issue · 1 comments

I noticed that in the current version of AB3, some invalid email addresses are not detected and can be added to a person without any error message.
(Reference to valid email address format: https://help.xmatters.com/ondemand/trial/valid_email_format.htm)

The current constraint for email address format is as followed (it is only shown in error message, should be added into UG for clarification):
"Emails should be of the format local-part@domain and adhere to the following constraints:

  1. The local-part should only contain alphanumeric characters and these special characters, excluding the parentheses, (!#$%&'*+/=?`{|}~^.-) .
  2. This is followed by a '@' and then a domain name. The domain name must:
    • be at least 2 characters long
    • start and end with alphanumeric characters
    • consist of alphanumeric characters, a period or a hyphen for the characters in between, if any."

Examples of these undetected invalid email address formats include:

  1. Starting or ending with a special character. E.g. abc-@mail.com and .abc@mail.com
  2. Consecutive special letters. E.g. abc..def@mail.com
  3. Missing top-level domain. E.g. abc.def@mail
  4. Domain shorter than 2 characters. E.g. abc.def@mail.c

Example of wrongly rejected email address format:

  1. Domain with more than 1 dot (every dot followed by at least two characters from a to z). E.g. e123456@u.nus.edu

I think that it will be better if the email address format accepted in AB3 can be modified accordingly to detect the better account for actual email addresses in reality.

@Zhang-Yunjie thanks for the suggestion.