Skip to content

Enhance email regex to catch common errors#3130

Merged
rtibbles merged 1 commit intolearningequality:unstablefrom
rtibbles:email_validation
May 3, 2021
Merged

Enhance email regex to catch common errors#3130
rtibbles merged 1 commit intolearningequality:unstablefrom
rtibbles:email_validation

Conversation

@rtibbles
Copy link
Copy Markdown
Member

@rtibbles rtibbles commented Apr 30, 2021

Summary

Description of the change(s) you made

Adds some extra restrictions to the email validation to protect against < and > being wrapped around email addresses.

Adds many tests to ensure we are not being too restrictive of valid email addresses, adds some tests of other emails we can safely exclude.

Examples drawn from here: https://en.wikipedia.org/wiki/Email_address#Examples

Manual verification steps performed

Unit tests


Reviewer guidance

How can a reviewer test these changes?

Check that valid email addresses can still have channels shared with them.
Check that <this@this.com> cannot be shared with.

References

Fixes #3021

Contributor's Checklist

Testing:

  • Code is clean and well-commented
  • Contributor has fully tested the PR manually
  • Critical and brittle code paths are covered by unit tests

Reviewer's Checklist

This section is for reviewers to fill out.

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@rtibbles rtibbles requested a review from marcellamaki April 30, 2021 00:15
@rtibbles rtibbles changed the title Enhance email regex to catch common erros Enhance email regex to catch common errors Apr 30, 2021
Copy link
Copy Markdown
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! (And good email resource - bookmarking that for future reference!)

@rtibbles rtibbles merged commit 26319f9 into learningequality:unstable May 3, 2021
@rtibbles rtibbles deleted the email_validation branch May 3, 2021 15:46
@pcenov
Copy link
Copy Markdown
Member

pcenov commented May 13, 2021

Tested at hotfixes.studio.learningequality.org - both sending invitations and the new email validation function correctly and as described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Email validation: Sending an email invitation does not validate that the email only contains valid email characters

3 participants