diff options
| author | Alexis Metaireau <alexis@notmyidea.org> | 2018-08-10 23:04:31 +0200 |
|---|---|---|
| committer | 0livd <github@destras.fr> | 2018-08-10 23:04:31 +0200 |
| commit | 9d76144a8333d6af81ddefddf59af38bd96a72ae (patch) | |
| tree | e9c6f6af2caa2b4635e6f1a8fe0fd7e62e105571 /ihatemoney/forms.py | |
| parent | 67de8c3b358bf513b2cd8c47838dd73c457abb9c (diff) | |
| download | ihatemoney-mirror-9d76144a8333d6af81ddefddf59af38bd96a72ae.zip ihatemoney-mirror-9d76144a8333d6af81ddefddf59af38bd96a72ae.tar.gz ihatemoney-mirror-9d76144a8333d6af81ddefddf59af38bd96a72ae.tar.bz2 | |
Fix failing tests (#365)
* Remove unwanted space in utils.py
* Fix email validation when sending invites
Diffstat (limited to 'ihatemoney/forms.py')
| -rw-r--r-- | ihatemoney/forms.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ihatemoney/forms.py b/ihatemoney/forms.py index 3966891..de9004d 100644 --- a/ihatemoney/forms.py +++ b/ihatemoney/forms.py @@ -10,6 +10,8 @@ from werkzeug.security import generate_password_hash from datetime import datetime from jinja2 import Markup +import email_validator + from ihatemoney.models import Project, Person from ihatemoney.utils import slugify @@ -184,9 +186,10 @@ class InviteForm(FlaskForm): submit = SubmitField(_("Send invites")) def validate_emails(form, field): - validator = Email() for email in [email.strip() for email in form.emails.data.split(",")]: - if not validator.regex.match(email): + try: + email_validator.validate_email(email) + except email_validator.EmailNotValidError as e: raise ValidationError(_("The email %(email)s is not valid", email=email)) |
