Skip to content

[FIX] my_compassion: ask consent at signup on every website - #450

Open
NoeBerdoz wants to merge 3 commits into
18.0from
18.0-signup-consent-all-websites
Open

NoeBerdoz wants to merge 3 commits into
18.0from
18.0-signup-consent-all-websites

Conversation

@NoeBerdoz

Copy link
Copy Markdown
Contributor

The Polish website's /web/signup had no consent checkbox: the checkbox views were bound to the Swiss main website (signup_sponsor) and to the Swiss my2 website (my2_signup_fields), so every other website rendered the stock form. Meanwhile _signup_with_values recorded legal_agreement_date on every signup, on any website, so a PL signup stored an agreement nobody was shown. Found while reviewing #443 and CompassionCH/tools#31.

What changes (my_compassion only)

  • One checkbox on every website. A generic extension of auth_signup.fields renders one required privacy_policy checkbox (label acceptance_full) when the server says consent is required. The two website-bound checkbox blocks are removed; their styling and password icons stay.
  • When consent is required (computed on the server): any signup without a token, and an invitation whose partner has no legal_agreement_date. Never on a password reset. An invitation token opened through /web/reset_password is sent to /web/signup (GET) or refused (POST), so it cannot skip consent.
  • Server enforcement in both signup paths: the password form (do_signup) and the verify-email passwordless form (auth_signup_verify_email), which goes straight to res.users.signup(). Without privacy_policy=accepted, no account is created and a translated error is shown, worded like the label (terms and conditions when the website has a terms URL, legal terms otherwise). The passwordless path no longer creates accounts on GET and forwards only login, name and the token/redirect/reCAPTCHA plumbing to the upstream handler, so a posted legal_agreement_date or other partner field is ignored.
  • Recording: the date is set from a server timestamp only when consent was given, never overwrites an existing date, and is carried to the existing partner when the async email matching (_find_and_replace_partner_async) replaces the signup partner, which lost it before. OAuth and backend calls to signup() are unchanged and record nothing.
  • Translations fr_CH, de_DE, it_IT, pl_PL; version 18.0.1.0.34.

Tests

tests/test_signup_consent.py, 20 tests: one checkbox on the Swiss main, my2 and a second MyCompassion website; both signup paths refused without consent (error wording with and without a terms URL) and accepted with it; invitations with and without a date, password reset, invalid token, invitation through the reset page; date kept across partner replacement; forged dates and extra fields on the passwordless form; direct backend signup(). The refusal, replacement, forged-field and wording tests fail without their fix. The rest of the my_compassion suite on a fresh database shows the same failures as origin/18.0 (no child, inactive payment methods), none new.

Deploy

-u my_compassion. Before or after: check that no website keeps a builder-edited copy of auth_signup.fields, auth_signup.signup, my_compassion.signup_sponsor or my_compassion.my2_signup_fields, and that each website's terms and privacy URLs resolve (/legal, /legal/terms).

Not in this PR

  • The PL website still gets the stock login, signup layout, password reset, contact and charter pages: the my2 views are bound to the Swiss my2 website. Giving every MyCompassion website that look needs its own design.
  • legal_agreement_date does not say which website or which version of the texts was accepted.

Use one shared consent field on all websites and validate it before both
password and verify-email signup. Classify validated invitation/reset tokens
on the server and prevent invitations from bypassing signup via the reset URL.

Record accepted consent on the actual signup partner before queuing its
replacement, preserve existing consent dates, and carry consent across partner
replacement. Keep backend and OAuth signup independent of website consent.

Add HTTP and model regression coverage, complete consent translations, and
bump the module to 18.0.1.0.34.

Assisted-by: gpt-6.1-sol, high, codex
The verify-email handler forwards request.params directly into privileged
signup, so submitted partner or user fields can set or overwrite consent
dates before the model's preservation guard runs.

After validating consent, expose only login/name from qcontext and the
token/redirect plumbing to the upstream handler. Preserve the reCAPTCHA
token for its verifier to consume and restore request params afterward.
Email is derived from login; consent dates come only from the server context.

Add HTTP regressions for forged consent dates on tokenless and invited
signup, extra partner fields, and preserved CAPTCHA verification. The three
injection regressions fail on 256de19 and all 19 consent tests pass with
the allowlist. The full suite adds no unrelated failures.

Assisted-by: gpt-6.1-sol, high, codex
Sites without a separate terms URL use the combined legal-terms label.
Select the refusal message from the same website terms_url branch so its
wording matches the checkbox for both password and passwordless signup.

Translate the legal-terms error in French, German, Italian and Polish using
the existing acceptance_full terminology. Cover both website configurations
and signup paths over HTTP; all 20 consent tests pass.

Assisted-by: gpt-6.1-sol, high, codex
@NoeBerdoz
NoeBerdoz requested review from Danielgergely and davidwul and removed request for Danielgergely November 5, 2026 15:00
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.

1 participant