Skip to content

alphagov/email-alert-frontend

Repository files navigation

Email alert frontend

A frontend for creating and managing email subscriptions.

Features

Signup

This app provides three routes for signing up to email:

  • A /email-signup?link=/:base_path route [example]. This route supports signup to several types of content. It was originally specific to the taxonomy (despite the generic name), and then got re-purposed for other document types.

  • A legacy /:base_path/email-signup route [example]. Each of these routes corresponds to a content item with an email_alert_signup schema. At the time of writing, /foreign-travel-advice/* still uses this route.

  • A /email/subscriptions/new route [example]. This route enables any other application to offer a fully customised email signup experience that is not reliant on the content store. It is used by apps like finder-frontend, where a new subscriber list is created from the combination of selected filters.

In order to verify the email for a new subscription, we send a verification email using Email Alert API. The email contains a link with a unique token for the subscription. Clicking on the link completes the signup process.

Manage

This allows the user to list, modify and delete their subscriptions [login]. It uses a similar, but separate email/token process to authenticate a user, establishing a session for them to make their changes.

Nomenclature

  • Tags and Links - strings that uniquely define a list to subscribe to

Technical documentation

This is a Ruby on Rails app, and should follow our Rails app conventions.

You can use the GOV.UK Docker environment to run the application and its tests with all the necessary dependencies. Follow the usage instructions to get started.

Use GOV.UK Docker to run any commands that follow.

Running the test suite

$ bundle exec rake

Publishing Routes

There are six routes provided by this app: /email-signup, /email-signup/confirm, /email/unsubscribe, /email/subscriptions, /email/authenticate and /email/manage. If you are deploying this app to a new environment, you will need to publish these routes using the special_route tasks in Publishing API

Testing account pages

Some pages are only accessible once a user has logged-in, using a link sent in an email. To test these pages locally, you will need to make a temporary change to the controller code to bypass authentication. If testing on a deployed branch, see the documentation on receiving emails from in Integration and Staging.

Licence

MIT License