Skip to content

feat: Standalone subscription form look/feel/functionality pass

stephen requested to merge standalone-subscription-form into main

The standalone form used for newsletter subscription is used as a fallback page to display when an error occurs in the process of a user attempting another newsletter operation - requesting or confirming a subscription, or modifying an existing subscription - and so is useful even given that newsletter.torproject.org is, itself, also a simple newsletter signup form.

This MR fully implements that standalone form, including both front-end and back-end validation. Upon successful submission of valid user data, civi.repository.newsletter_signup() is called with the appropriate user data.

In particular:

  • The subscription logic inside the SubscriptionForm class has been moved to the form view, where it can be invoked upon successful form validation.
  • Said form view now additionally has logic for handling unsuccessful form validation, and for properly displaying form errors on a per-field basis as is done on the donation form.
  • An additional view has been added, with its own route at /subscription-requested/, to be displayed when a user successfully submits the standalone subscription form.
  • The standalone subscription form has been redesigned to match the Bootstrap5-powered donation form layout, and to use Django's CSRF token for security. Form field error handling has been implemented both on the front and the back end.

Merge request reports