Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various co-sign improvements #4320

Closed
17 of 19 tasks
joeribekker opened this issue May 22, 2024 · 7 comments · Fixed by open-formulieren/formio-builder#192, #4808, open-formulieren/open-forms-sdk#729, #4838 or #4887
Closed
17 of 19 tasks

Comments

@joeribekker
Copy link
Contributor

joeribekker commented May 22, 2024

Thema / Theme

Frontend

Omschrijving / Description

To do now

For actual text changes, see #4320 (comment)

Globaal

  • Het woord "mede-ondertekener" moet worden "mede-ondertekenaar"

  • Bij het gebruik van een link in de mede-onderteken e-mail:

    • Verberg mede-onderteken blok op het formulier
    • Stuur een link in de mede-onderteken e-mail, die een code in de URL bevat dat het om mede-ondertekenen gaat.
    • Toon enkel het mede-onderteken blok als de URL de code van hierboven bevat (verberg dus de mogelijkheid om gewoon in te loggen)
    • Geen tussenstap om code in te voeren

Startpagina

  • Tekstwijziging bij mede-onderteken blok: Heeft u een e-mail ontvangen om mede te ondertekenen? Start het mede-ondertekenen door in te loggen.

Bevestigingspagina

  • Tekstwijziging titel
  • Tekstwijziging body
  • Toon NIET het nummer indien links worden gebruikt
  • Toon direct een knop "Nu mede-onderteken" (die de link gebruikt om mede te ondertekenen)

Bevestigings e-mail naar de indiener

  • Tekstwijziging: Onderwerp moet niet "bevestiging" bevatten en ook geen referentienummer. Dit geeft de indruk dat het klaar is.
  • Verwijder kopje "samenvatting" als er geen samenvatting is
  • Tekstwijziging: Body

Mede-onderteken e-mail

  • Tekstwijziging: Body (meer B1)
  • Betere layout (kopje)

Bevestiging mede-ondertekening

  • Tekstwijziging. Wellicht meer zoals de standaard bevestiging

  • Bij co-signing wordt de 'ingezonden op...' datum al gegenereerd voordat het formulier is ingezonden. De behandelaar heeft de inzending nog niet ontvangen op dat moment. Hier kunnen juridische issues door ontstaan. -> gaat om PDF, input DH

Later

Globaal

  • Meerdere PDFs met onderscheid in wat relevant is (tevens wel/niet betaald, wel/niet mede-ondertekend). Deze als versies opslaan.

Mede-onderteken component

  • Vraag om BSN (of selecteer partner in latere fase)
@joeribekker joeribekker added epic Large theme and/or meta issue enhancement topic: mede-ondertekenen owner: druten blocked triage Issue needs to be validated. Remove this label if the issue considered valid. labels May 22, 2024
@joeribekker
Copy link
Contributor Author

This ticket will include:

  • Removal of component and integrate it as a form-feature
  • Refactor of email templating into a separately managed model (library)

@joeribekker
Copy link
Contributor Author

@sergei-maertens will add details that we discussed.

@sergei-maertens
Copy link
Member

Writing these down so we don't forget what was discussed last Friday

We'll build CoSign v3 and deprecate/remove v1 and v2. Now cosign is set up as a formio component, but that is a "wrong" approach since you can only ever use one such component in the entire form (which goes against the idea of a component). Implementation of requested changes is also very hard if we keep treating it as a formio component, so let's stop doing that.

  • Whether cosigning is required or not will become a Form level field/configuration/flag.
  • This means we can expose whether it's a co-sign form or not quite easily in the form detail endpoint
  • We make entering the co-sign information something that needs to be provided on the confirmation page (similar to accepting the terms and conditions/privacy policy etc.). We store email address + (optional?) BSN of the cosigner in the submission object. Need to take security/privacy into account, so figure out if we need to hash/encrypt the BSN (depends on whether we display it in the confirmation PDF or not).
  • Detecting whether links are sent in emails or not can be done by inspecting the cosign email template for the presence of the {{ form_url }} variable -> should be exposed in form detail so we can render/hide the cosign login button(s).
  • Cosign components are now sometimes made conditional with logic, depending on whether the user has a partner or not, for example. We can add a logic action set_cosign_required to True | False based on some conditions. We then record on the Submission if cosign is required.

About email templates - we get various template variants, depending on whether the submissions needs cosigning/payment/.... Handling all these cases (for a subject, for example) with {% if %} statements is pretty hostile to functional administrators needing to manage this content. For that reason, we decided that we should revamp our (email) template system.

  • Configure email templates as individual records. This should allow configuration of subject + body as one record. A template is semantically identified by the combination of (template_type, language) - template type is then for example submission_confirmation, cosign_request, payment_required etc.
  • Code sending emails will need to understand the various combinations and how they map to the template type, look up the relevant template and render it
  • Data migrations need to populate the table with initial templates that we ship, as starting points. There should be some way to ensure that all languages and template types are configured (post migrate hook?), since new types and languages can be added after this data migration was run (for existing instances).
  • Email templates need to be properly validated - we need to be able to configure per type which variables/tags are expected/allowed. Some openforms.template functionality will need to be ported.
  • https://github.com/maykinmedia/mail-editor should ideally be used, if required, we will further extend it to serve our needs

Some more Q & A from Slack:

  • No in-between step to enter code -> pass it directly in the link from the email as query param, e.g. ?cosignSubmission=OF-123. Could also become a backend URL with a time-expiring token that automatically invalidates the link, similar to the resume form link. Details to be sorted out.
  • Multiple PDF versions -> the actual/content rendering may require additional context or render modes in our node visitor (Renderer class) that actually generates the PDF content

@joeribekker
Copy link
Contributor Author

@joeribekker joeribekker added this to the Release 3.0 milestone Sep 18, 2024
@joeribekker
Copy link
Contributor Author

this is an updated version of 2

sergei-maertens added a commit to open-formulieren/formio-builder that referenced this issue Nov 1, 2024
Non-crucial patch since it only affects the admin interface, but let's
do it anyway to be consistent.
sergei-maertens added a commit that referenced this issue Nov 1, 2024
Users who have the link in the email are directly taken to the
right place to start the cosign process. This obsoletes the
entrypoint at the form start, and by not returning any login options
for cosign, we prevent this block from appearing in the frontend.

Detection of a link is used or not is done by checking for the
presence of the 'form_url' context variable in the request
email template.
sergei-maertens added a commit that referenced this issue Nov 1, 2024
If URLs in emails are enabled for the cosign request email, create a
more useful URL to the form by giving a 'init-cosign' instruction,
passing along the submission reference/code so that we can auto-populate
that information and cut out intermediate screens for the end-user.

If URLs are not enabled, we stick to the old behaviour.
sergei-maertens added a commit that referenced this issue Nov 1, 2024
Now also emit whether links are enabled or not, and let the frontend code
decide based on this information whether options should be rendered
or not. We need access to the options in certain views on the frontend,
and we cannot pass a query param to opt in/out from the frontend as
the API call to retrieve the form is done *after* the param processing.
sergei-maertens added a commit to open-formulieren/open-forms-sdk that referenced this issue Nov 1, 2024
…s if links in emails are not allowed

The link in emails are proper deep-links that bring the user
directly to the required start page.
sergei-maertens added a commit to open-formulieren/open-forms-sdk that referenced this issue Nov 1, 2024
… login URL

If a code query parameter is present in the route params, use it to
pre-populate the code parameter for the ?next param, which redirects
to the submission look-up page on the backend. This will allow the
backend to shortcut the form by auto-populating it and validating the
authentication state, requiring less user input.

This page also works without the parameter and follows the 'old' flow.
The login screens will be updated accordingly to redirect to this page.
sergei-maertens added a commit that referenced this issue Nov 1, 2024
If the code querystring parameter is provided, perform the form validation
in the GET request rather than requiring the user to fill out the form,
and automatically redirect back to the frontend to do the cosigning.

There is a minor risk for CSRF here, *if* the attacker is able to
guess the submission reference + form combination and the victim
has an active, authenticated session. Note that the session idle
time is capped at 15 minutes, so the risk is considered not
problematic.
sergei-maertens added a commit that referenced this issue Nov 8, 2024
Users who have the link in the email are directly taken to the
right place to start the cosign process. This obsoletes the
entrypoint at the form start, and by not returning any login options
for cosign, we prevent this block from appearing in the frontend.

Detection of a link is used or not is done by checking for the
presence of the 'form_url' context variable in the request
email template.
sergei-maertens added a commit that referenced this issue Dec 5, 2024
…or not

This is necessary to display the right text on the cosign confirmation
page, as a form may have email confirmations disabled.
sergei-maertens added a commit to open-formulieren/open-forms-sdk that referenced this issue Dec 5, 2024
Open Forms 3.0 will expose whether confirmation emails are sent
or not in the detail endpoint.
sergei-maertens added a commit to open-formulieren/open-forms-sdk that referenced this issue Dec 5, 2024
…text

Texts taken from the provided document with desired content. Opted to
not make this configurable yet until we start working on CoSign v3.
sergei-maertens added a commit that referenced this issue Dec 5, 2024
The PDF was including the cosign data/component for version 1 of cosign,
which is not compatible at all with v2 (see #4308), causing crashes.

Generally this doesn't matter since the PDF is generated right after
submission is received and before its cosigned, and we don't usually
need to re-generate it except during development.
@sergei-maertens sergei-maertens moved this from In Progress to Implemented in Development Dec 5, 2024
sergei-maertens added a commit that referenced this issue Dec 6, 2024
* Added better structure to the email
* Used simpler language for accessibility

Existing instances unfortunately do not automatically get this
improvement, they will have to edit their configuration.
sergei-maertens added a commit that referenced this issue Dec 6, 2024
…or not

This is necessary to display the right text on the cosign confirmation
page, as a form may have email confirmations disabled.
sergei-maertens added a commit that referenced this issue Dec 6, 2024
The PDF was including the cosign data/component for version 1 of cosign,
which is not compatible at all with v2 (see #4308), causing crashes.

Generally this doesn't matter since the PDF is generated right after
submission is received and before its cosigned, and we don't usually
need to re-generate it except during development.
sergei-maertens added a commit that referenced this issue Dec 6, 2024
The cosign information/state was smeared out across the form and
submission model, and is consulted in a number of places to control
template/feedback behaviour.

The implementation details of how cosign works are now properly
encapsulated in a data structure, which also allows us to prepare for
cosign v3 which will most-likely not be Formio based.
sergei-maertens added a commit that referenced this issue Dec 6, 2024
The cosign information/state was smeared out across the form and
submission model, and is consulted in a number of places to control
template/feedback behaviour.

The implementation details of how cosign works are now properly
encapsulated in a data structure, which also allows us to prepare for
cosign v3 which will most-likely not be Formio based.
@github-project-automation github-project-automation bot moved this from Implemented to Done in Development Dec 6, 2024
@github-project-automation github-project-automation bot moved this from Done to In Progress in Development Dec 6, 2024
@sergei-maertens sergei-maertens moved this from In Progress to Implemented in Development Dec 6, 2024
sergei-maertens added a commit that referenced this issue Dec 6, 2024
The cosign information/state was smeared out across the form and
submission model, and is consulted in a number of places to control
template/feedback behaviour.

The implementation details of how cosign works are now properly
encapsulated in a data structure, which also allows us to prepare for
cosign v3 which will most-likely not be Formio based.
@github-project-automation github-project-automation bot moved this from Implemented to Done in Development Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment