Add organization to account email links

What does this MR do and why?

Adds organization_id to links sent in Devise mailers, so that user confirmations, password resets and unlocks can be routed to the correct cell.

Part 1 of 2 for de-scoping multiple UNIQUE indexes on the users table. We need to add organization_id to the links sent via email in these cases. Users will generally be clicking through these email links unauthenticated, so the requests have to be route-able to the correct cell.

Once emails sent out are route-able, we can de-scope the indexes so that confirmation_token , reset_password_token , and unlock_token are unique per-organization rather than globally. Changing indexes will be part 2 / 2.

References

Screenshots or screen recordings

Before After
Screenshot_2025-10-31_at_12.24.49_PM

How to set up and validate locally

  1. Use the Rails mailer previews: https://gdk.test:3443/rails/mailers
  2. Confirmation instructions: https://gdk.test:3443/rails/mailers/devise_mailer/confirmation_instructions_for_new_email
  3. Reset password instructions: https://gdk.test:3443/rails/mailers/devise_mailer/reset_password_instructions
  4. Unlock instructions: https://gdk.test:3443/rails/mailers/devise_mailer/unlock_instructions

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #562090

Edited by Andrew Evans

Merge request reports

Loading