Skip to content

Asap 198 setup emails and password reset - #242

Merged
lkacenja merged 42 commits into
devfrom
asap-198-setup-emails-and-password-reset
Jul 29, 2025
Merged

Asap 198 setup emails and password reset#242
lkacenja merged 42 commits into
devfrom
asap-198-setup-emails-and-password-reset

Conversation

@lkacenja

@lkacenja lkacenja commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

We want to be able to send transactional emails from our app. This will enable the password reset and a simple invitation workflow.

This PR adds the following:

  • OpenTofu config for setting up AWS Simple Email Service (SES).

  • Production configuration to use SES to send emails.

  • Mail templates for simple password-related messages.

  • UI and workflow for password reset.

  • A simple admin invitation workflow

  • Some light test coverage for emails.

  • What additional steps are required to test this branch locally?

Testing mail locally requires some extra setup.

Copy the following configuration over config/environments/development.rb line 25.

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    address: ENV.fetch("SMTP_ENDPOINT"),
    port: 587,
    domain: "demo.codeforamerica.ai",
    user_name: ENV.fetch("SMTP_USER"),
    password: ENV.fetch("SMTP_PASSWORD"),
    authentication: "plain"
  }
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = false
  config.action_mailer.default_url_options = {host: "demo.codeforamerica.ai"}

Get values for SMTP from last pass and copy into the above configuration in place of "ENV.fetch" statements.

Make sure to run database migrations. Try testing out email features.

NB: Emails sent from localhost will likely get flagged as spam by Gmail. This should be fixed in production.

  • Are there any areas you would like extra review?

Try out the password reset and admin invitation workflow. For the latter visit "/admin/users/new" and check the "Send invitation email" box.

  • Are there any rake tasks to run on production?

No.

lkacenja added 30 commits July 10, 2025 09:08
@lkacenja lkacenja self-assigned this Jul 28, 2025
@lkacenja
lkacenja changed the base branch from dev to main July 28, 2025 18:17
@lkacenja
lkacenja changed the base branch from main to dev July 28, 2025 18:17
@lkacenja
lkacenja marked this pull request as ready for review July 28, 2025 19:50
@lkacenja
lkacenja requested a review from allisonmorgan July 28, 2025 19:53

@allisonmorgan allisonmorgan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This worked great for me locally. I was able to invite a new user and have them set up their password over email. I also went through the password reset flow.

Minor nit: This might just be me, but I didn't register "Forgot your password?" or "Back to log in" as links. I think it could be as simple as highlighting them in the red color we use for links in the emails or an underline, but also happy to create a follow-up JIRA issue to discuss as a group.

imageimage

@lkacenja

lkacenja commented Jul 29, 2025

Copy link
Copy Markdown
Contributor Author

Minor nit: This might just be me, but I didn't register "Forgot your password?" or "Back to log in" as links. I think it could be as simple as highlighting them in the red color we use for links in the emails or an underline, but also happy to create a follow-up JIRA issue to discuss as a group.

Good idea! Done in 97c1759. Happy to review as a group as well.

@lkacenja

Copy link
Copy Markdown
Contributor Author

Noting that the OpenTofu configuration in the PR is blocking deployments to production. Going to temporarily comment out the password reset link. This is the only public, user facing change. We can return the link, once email is operational.

@lkacenja
lkacenja merged commit 4de6d89 into dev Jul 29, 2025
2 checks passed
@lkacenja
lkacenja deleted the asap-198-setup-emails-and-password-reset branch April 7, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants