Skip to content
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

Update email validation with Truemail #393

Merged
merged 9 commits into from
Jun 12, 2024
Merged

Conversation

delano
Copy link
Collaborator

@delano delano commented Jun 12, 2024

This pull request updates the email validation in the codebase to use the Truemail gem. Truemail provides comprehensive email validation by checking the domain, MX records, and SMTP server to ensure that the email address is valid. This will help us avoid sending emails to invalid addresses and improve our mail deliverability.

This work only replaces the regex logic and doesn't use the advanced features from Truemail. Later on we'll check the deliverability etc.

Fixes #392

Rationale: truemail is a gem that goes above and beyond when it comes to
validating email addresses. It checks the domain, the MX records, and
the SMTP server to ensure that the email address is valid. We will use
it to ensure that the email addresses being used by the application are
valid. This will help us to avoid sending emails to invalid email
addresses and improve our mail deliverability.
Changed start methods to clarify boot process:

- Renamed Onetime.load! to Onetime.boot! to better reflect its purpose
of initializing the application
- Updated references to the boot method throughout the codebase
- Added documentation to Onetime module and boot method describing the
boot process

This simplifies initialization and improves grokability by using more
precise terminology. The name "load" was somewhat ambiguous, while
"boot" more clearly conveys that the application is being started up and
prepared to serve requests. "Boot" also implies there's an order of
operations which is important to understand when working with the
application.

Notes:

- No functional changes, just naming for clarity
- More boot process documentation to be added
The `OT::Config.after_load` method was added to run additional
initialization tasks after loading the configuration. It extracts the
`:from` email address from the config and configures TrueMail
accordingly.

Set TrueMail verifier email address after loading onetime configuration.
This ensures the verifier email is set properly based on the config,
avoiding errors during email validation.
Includes tests for existing email validation logic.
Current we're validating just the format of the email address. Let we'll
leverage the Truemail gem to validate whether the email address is
actually deliverable, not on a deny list, and not a temporary email
address.
@delano delano added improvement Issues or pull requests that involve improvements to the project. dependencies Pull requests that update a dependency file labels Jun 12, 2024
@delano delano self-assigned this Jun 12, 2024
@delano delano added security Issues or pull requests related to security. ux Work that improve user experience, interaction patterns, or interface usability Bug fix labels Jun 12, 2024
@delano delano linked an issue Jun 12, 2024 that may be closed by this pull request
1 task
lib/onetime/logic/base.rb Dismissed Show dismissed Hide dismissed
@delano delano merged commit d47327d into develop Jun 12, 2024
5 of 9 checks passed
@delano delano deleted the 392-update-email-validation branch June 12, 2024 06:39
delano added a commit that referenced this pull request Jun 12, 2024
This is a partial revert for commit 4b9ae8c (PR #393)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file improvement Issues or pull requests that involve improvements to the project. security Issues or pull requests related to security. ux Work that improve user experience, interaction patterns, or interface usability
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Update email validation
1 participant