Skip to content

Validate email addresses before saving them to the database #9365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Aug 30, 2024

#921 introduced a way for users to change their registered email addresses, but the code in the PR did not check if the supplied email addresses are valid and only relied on the email verification process. This led us to having about two dozens "email addresses" in our database now that aren't actually valid email addresses (e.g. people replacing @ with [at] and other fun examples).

This PR passes the supplied email address to a .parse::<lettre::Address>() call and returns an HTTP error if the supplied email is invalid.

@Turbo87 Turbo87 added C-bug 🐞 Category: unintended, undesired behavior A-backend ⚙️ labels Aug 30, 2024
@Turbo87 Turbo87 enabled auto-merge (squash) August 30, 2024 12:48
@Turbo87 Turbo87 merged commit f0b0960 into rust-lang:main Aug 30, 2024
8 checks passed
@Turbo87 Turbo87 deleted the validate-emails branch August 30, 2024 13:01
Copy link

codecov bot commented Aug 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.20%. Comparing base (e8ee8c4) to head (a3b58d9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9365      +/-   ##
==========================================
- Coverage   89.20%   89.20%   -0.01%     
==========================================
  Files         283      283              
  Lines       29096    29107      +11     
==========================================
+ Hits        25956    25965       +9     
- Misses       3140     3142       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-bug 🐞 Category: unintended, undesired behavior
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant