Skip to content

Commit

Permalink
Add email validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pvandyken committed Sep 16, 2023
1 parent 5ef8d3c commit d2d62c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions snakebids/project_template/copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ full_name:
help: What is your name?
default: '{% gitconfig "user.name" %}'

email_regex:
default: (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
when: false

email:
type: str
help: What is your email?
default: '{% gitconfig "user.email" %}'
validator: >-
{% if email and not (email | regex_search(email_regex)) %}
Must be a valid email
{% endif %}
github:
type: str
Expand Down

0 comments on commit d2d62c4

Please sign in to comment.