Commit graph

14 commits

Author SHA1 Message Date
Paul Chavard
b3aeb46c1b fix(prefill): it should be possible to prefill a dossier on a test procedure 2023-06-14 09:14:12 +01:00
Damien Le Thiec
802a23057b Microtest dossier prefill get without stored queries 2023-02-13 18:15:24 +01:00
sebastiencarceles
6c5b82ebbf filter out locale from stored query params
As 'locale' isn't a param we want to prefill a dossier, we ignore it
and remove it from the stored query params.
2023-02-09 13:51:52 +01:00
sebastiencarceles
e212055ef8 tell when query params have been stored 2023-02-09 13:51:52 +01:00
Paul Chavard
f22cc8812b secu(graphql): log full queries and variables 2023-02-08 15:10:27 +01:00
Sébastien Carceles
20136b7ac8
feat(demarche): create and prefill a dossier with POST request (#8233)
* add base controller for public api

* add dossiers controller with basic checks

* create the dossier

* ensure content-type is json

* prefill dossier with given values

* mark a dossier as prefilled

When a dossier is prefilled, it's allowed not to have a user.

Plus, we add a secure token to the dossier, which we will need later to set a
user after sign in / sign up.

* set user as owner of an orphan prefilled dossier

When a visitor comes from the dossier_url answered by the public api,
the dossier is orphan:
- when the user is already authenticated: they become the owner
- when the user is not authenticated: they can sign in / sign up / france_connect
and then they become the owner

So here is the procedure:
- allow to sign in / sign up / france connect when user is unauthenticated
- set dossier ownership when the dossier is orphan
- check dossier ownership when the dossier is not
- redirect to brouillon path when user is signed in and owner

* mark the dossier as prefilled when it's prefilled
(even with a GET request, because it will be useful later on, for
exmample in order to cleanup the unused prefilled dossiers)

* system spec: prefilling dossier with post request
2023-01-03 14:46:10 +01:00
Sébastien Carceles
b8ff0ba4a2
feat(demarche): sign up when prefilling a dossier (#8247)
* store prefill params in session

Instead of using query params on /dossier/new, we assume the user comes
from /commencer/:path, which is the new prefill link.

There, we store the prefill params in session, and use them to prefill
the dossier when creating it, in /dossiers/new.

* spec: cover the case

* review: serialize with json instead of yaml

* review: rename method

* review: store only query params

* review: comment why we dont override already stored params
2022-12-15 10:58:17 +01:00
Paul Chavard
69d5713c19 fix(turbo): fix anonymous controller RSpec test
https://github.com/hotwired/hotwire-rails/issues/42
2022-04-21 19:41:27 +02:00
Paul Chavard
758e7d68e6 fix(graphql): fix and improuve query parsing for logs 2021-11-24 13:23:05 +03:00
Pierre de La Morinerie
eef90efd49 app: fix exception during password reset when the token has expired 2021-09-21 10:30:09 -05:00
Pierre de La Morinerie
428ca8755f app: add a password_complexity component
This component will replace the previous `password_field` component.
2021-09-09 09:40:39 -05:00
Pierre de La Morinerie
4cb747fdb6 specs: always require rails_helper
Test helpers are separated between two files: spec_helper and
rails_helper. This separation is meant to allow tests that do not
require Rails (like testing standalone libs) to boot faster.

The spec_helper file is always loaded, through `--require spec_helper`
in the `.rspec` config file. When needed, the rails_helper file is
expected to be required manually.

This is fine, but:
- Many test files have a redundant `require 'spec_helper'` line;
- Many test files should require `rails_helper`, but don't.

Not requiring `rails_helper` will cause the Rails-concerned section of
the test environment not to be configured–which may cause subtle bugs
(like the test database not being properly initialized).

Moreover, Spring loads all the Rails files on preloading anyway. So the
gains from using only `spec_helper` are thin.

To streamline this process, this commit:
- Configures `.rspec` to require `rails_helper` by default;
- Remove all manual requires to spec_helper or rails_helper.

Reference: https://stackoverflow.com/questions/24145329/how-is-spec-rails-helper-rb-different-from-spec-spec-helper-rb-do-i-need-it
2020-03-31 12:48:32 +02:00
Pierre de La Morinerie
bb753ce23e commencer: redirect to the procedure page after sign-in and sign-up 2019-01-21 14:45:38 +01:00
Pierre de La Morinerie
4fd9fa6610 sign_in: extract the procedure context to a ProcedureContextConcern 2019-01-17 11:07:09 +01:00