getgrav / grav-plugin-email

Grav Email Plugin
http://getgrav.org
MIT License
37 stars 29 forks source link

Fix email validation rule #186

Open timmwille opened 2 months ago

timmwille commented 2 months ago

I'm not sure it is related or similar to #183 so I wanted to add a fix idea though I'm not a software developer myself, for another project I researched and improved the following regex term to define the proper Mail spectrum:

[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}

I dont know if it can be the basis here, but currently the rule: email does only check until name@domain not for name@domain.tld so this could be improved to avoid failure.

our current fix we use is adding a pattern (but the output is not so nice):

        - name: email
          id: email
          classes: form-control form-control-lg
          label: Email
          placeholder: Deine EMail-Adresse
          type: email
          validate:
            rule: email
            required: true
            pattern: "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"

CC @MartinSchott