Fix failing tests (#365)

* Remove unwanted space in utils.py

* Fix email validation when sending invites
This commit is contained in:
Alexis Metaireau 2018-08-10 23:04:31 +02:00 committed by 0livd
parent 67de8c3b35
commit 9d76144a83
3 changed files with 7 additions and 2 deletions

View file

@ -14,6 +14,7 @@ Fixed
- Fix the generation of the supervisord template (#309)
- Fix the validation of the hashed password (#310)
- Fix infinite loop that happened when accessing / (#358)
- Fix email validation when sending invites
Added
=====

View file

@ -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))

View file

@ -11,3 +11,4 @@ raven
blinker
six>=1.10
itsdangerous>=0.24
email_validator>=1.0