Skip to content

Email validation is too strict #1179

@adamrp

Description

@adamrp

Just saw this error on the server (actual email censored, but it contains undrescores):

Traceback (most recent call last):

  File "/home/qiita/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/web.py", line 1141, in _when_complete
    callback()

  File "/home/qiita/.virtualenvs/qiita/lib/python2.7/site-packages/tornado/web.py", line 1162, in _execute_method
    self._when_complete(method(*self.path_args, **self.path_kwargs),

  File "/home/qiita/qiita_main/qiita_pet/handlers/auth_handlers.py", line 39, in post
    created = User.create(username, password, info)

  File "/home/qiita/qiita_main/qiita_db/user.py", line 196, in create
    raise IncorrectEmailError("Bad email given: %s" % email)

IncorrectEmailError: Bad email given: email_with_underscores@hotmail.com

This is because of User.validate_email, which disallows underscores, even though they should be allowed.

Additionally, line 487

return True if match(pattern, email) is not None else False

can be simplified to

return match(pattern, email) is not None

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions