Click
  1. Click
  2. CLK-778

EmailField Data Validation Is Insufficient

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: extras
    • Labels:
      None

      Description

      In the Click Extras project, the current EmailField validation does not sufficiently limit user input to the format of an email address. As an example, I loaded the Avoka examples site and was able to successfully submit the following as an email address in the Extra Form Controls page:

      how.can@this@be@a@valid.email.address

      For my own use I have extended EmailField with the following additional validation logic:

      private static final Pattern EMAIL_ADDRESS_REGEX_PATTERN = Pattern.compile("^[a-zA-Z0-9._%+-]@[a-zA-Z0-9.-]
      .[a-zA-Z]

      {2,4}

      $", Pattern.CASE_INSENSITIVE);
      ...

      @Override
      public void validate() {
      super.validate();
      if (EMAIL_ADDRESS_REGEX_PATTERN.matcher(StringUtils.trimToEmpty(this.value)).matches())

      { this.setErrorMessage("email-format-error"); }

      }

        Issue Links

          Activity

          Adrian A. made changes -
          Link This issue incorporates CLK-774 [ CLK-774 ]
          Adrian A. made changes -
          Fix Version/s 3.0.0 [ 12315124 ]
          Naoki Takezoe made changes -
          Field Original Value New Value
          Assignee Naoki Takezoe [ takezoe ]
          Clint Lawrence created issue -

            People

            • Assignee:
              Naoki Takezoe
              Reporter:
              Clint Lawrence
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Development