Commit graph

14198 commits

Author SHA1 Message Date
Pierre de La Morinerie
01b0d15f5a
Merge pull request #6566 from betagouv/cache-pasword-complexity 2021-10-25 15:48:32 +02:00
Pierre de La Morinerie
d0e87a08cf services: cache zxcvbn dictionaries per-thread
Before, every time a password was tested, the dictionaries were parsed
again by zxcvbn.

Parsing dictionaries is slow: it may take up to ~1s. This doesn't matter
that much in production, but it makes tests very slow (because we tend
to create a lot of User records).

With this changes, the initializer tester is shared between calls, class
instances and threads. It is lazily loaded on first use, in order not to
slow down the application boot sequence.

This uses ~20 Mo of memory (only once for all threads), but makes tests
more that twice faster.

For instance, model tests go from **8m 21s** to **3m 26s**.

NB:
An additionnal optimization could be to preload the tester on
boot, before workers are forked, to take advantage of Puma copy-on-write
mechanism. In this way all forked workers would use the same cached
instance.

But:

- We're not actually sure this would work properly. What if Ruby updates
  an interval ivar on the class, and this forces the OS to copy the
  whole data structure in each fork?
- Puma phased restarts are not compatible with copy-on-write anyway.

So we're avoiding this optimisation for now, and take the extra 20 Mo
per worker.
2021-10-25 12:04:56 +02:00
Pierre de La Morinerie
5818841daa
Merge pull request #6581 from betagouv/remove-puma-boot-code 2021-10-25 11:48:03 +02:00
Pierre de La Morinerie
136d0bc341 config: remove pre and post boot code from puma config
This is no longer needed since Rails 5.1.

See https://github.com/rails/rails/pull/31241
2021-10-25 11:28:09 +02:00
Paul Chavard
422265886a
Merge pull request #6573 from tchak/fix-purge-stale-transfers
fix(transfer): manually nullify staled transfers references
2021-10-21 14:58:28 +02:00
Paul Chavard
1561ea82f6 fix(transfer): manually nullify staled transfers references 2021-10-21 13:54:26 +02:00
Paul Chavard
68899715e0
Merge pull request #6465 from tchak/dossier-rebase
Rebase dossiers en brouillon
2021-10-21 11:31:12 +02:00
Paul Chavard
c5a67623db
Merge pull request #6572 from betagouv/main
2021-10-20-01
2021-10-20 17:28:53 +02:00
Paul Chavard
2a3a9dd822 feat(revisions): rebase dossiers brouillons 2021-10-20 17:26:09 +02:00
Paul Chavard
09a09d3fcf feat(revisions): add rebased_at to champs 2021-10-20 17:26:09 +02:00
Paul Chavard
67e98f79c9 feat(revisions): add stable_id to changes 2021-10-20 17:25:34 +02:00
Paul Chavard
7cf82c6dfb
Merge pull request #6571 from tchak/fix-improuve-export
Améliorer les perfs des exports
2021-10-20 17:18:08 +02:00
Paul Chavard
1ca8192864 perf(export): load dossiers.champs in batches 2021-10-20 16:52:38 +02:00
Paul Chavard
7e5d388ef8 fix(export): add index on champs.etablissement_id 2021-10-20 16:51:41 +02:00
LeSim
f907c71744
Merge pull request #6567 from betagouv/main
2021-10-20-01
2021-10-20 13:43:48 +02:00
Pierre de La Morinerie
5479a76e31
Merge pull request #6560 from betagouv/update-phonelib
Gems : mise à jour de phonelib (#6560)
2021-10-20 09:38:27 +02:00
Pierre de La Morinerie
2ad9955e10 gems: update phonelib
Fixes a warning during tests:

> /home/runner/work/demarches-simplifiees.fr/demarches-simplifiees.fr/vendor/bundle/ruby/2.7.0/gems/phonelib-0.6.48/lib/validators/phone_validator.rb:65: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
> /home/runner/work/demarches-simplifiees.fr/demarches-simplifiees.fr/vendor/bundle/ruby/2.7.0/gems/activemodel-6.1.4.1/lib/active_model/errors.rb:404: warning: The called method `add' is defined here
2021-10-20 09:34:56 +02:00
LeSim
6535b31d09
Merge pull request #6562 from betagouv/adapt_admin_whitelist
modifie la liste des domaines en liste blanche
2021-10-19 21:16:07 +02:00
simon lehericey
738d08a1d9 change in whitelist 2021-10-19 21:07:24 +02:00
lydiasan
fc891a2b22
Merge pull request #6440 from betagouv/i18n-selector
i18n: affichage du sélecteur de langues pour les navigateurs non-francophones
2021-10-19 18:17:43 +02:00
lydiasan
6f9c3abfbc i18n: display language selector on non-french accept-languages 2021-10-19 16:41:36 +02:00
Pierre de La Morinerie
7b6420d427 specs: set i18n cookie before running browser specs
Otherwise the browser specs use the dault browser language, which may
be English depending on the system language.
2021-10-19 16:41:36 +02:00
Pierre de La Morinerie
0de8fd23c7 specs: remove invalid js: true specifier
Views specs cant't run Javascript.
2021-10-19 16:41:36 +02:00
LeSim
39a5d80a53
Merge pull request #6552 from betagouv/a_super_admin_can_merge_admin
Un super administrateur peut changer l'email d'un administrateur
2021-10-19 16:22:47 +02:00
simon lehericey
d19ad2840c rename preexisting to targeted, remove duplicated test 2021-10-19 16:12:42 +02:00
simon lehericey
52b7e85954 merge administrateur in user_controller 2021-10-19 16:12:42 +02:00
simon lehericey
866df74706 merge admin 2021-10-19 16:12:42 +02:00
LeSim
c15e1a6de4
Merge pull request #6551 from betagouv/allow_some_instructeur_to_change_their_profile
Laisse les instructeurs changer leur emails vers des domaines autorisés
2021-10-19 16:03:29 +02:00
simon lehericey
44c880adc4 allow instructeur and administrateur to change their email to legit domain (#6550) 2021-10-19 15:54:57 +02:00
Paul Chavard
8616a06937
Merge pull request #6548 from tchak/feat-add-admin-from-manager
feat(manager): bring back add administrateur
2021-10-19 13:21:29 +02:00
Paul Chavard
8fa544e176 feat(manager): bring back add administrateur 2021-10-19 12:06:31 +02:00
LeSim
98107eb7da
Merge pull request #6555 from betagouv/fix_fc
FC ne lève pas d'exception lorsque le merge concerne un compte qui n'existe pas
2021-10-19 12:05:32 +02:00
simon lehericey
f54dfe6ead Do not raise error if user is nil
I do not get when it happens
2021-10-19 11:21:24 +02:00
LeSim
a14ea5f0f4
Merge pull request #6549 from betagouv/main
2021-10-14-01
2021-10-14 17:46:15 +02:00
LeSim
2248b76d09
Merge pull request #6546 from betagouv/improve_FC
Corrige le connecteur FranceConnect
2021-10-14 15:03:26 +02:00
simon lehericey
46fd15416b add end to end test 2021-10-14 14:47:50 +02:00
simon lehericey
bb83fd2f18 To make an old test work, no idea 2021-10-14 14:47:50 +02:00
simon lehericey
933d7b8c8d merge with another preexisting account 2021-10-14 14:47:50 +02:00
simon lehericey
ce40e1127d merge with another new account 2021-10-14 14:47:50 +02:00
simon lehericey
19f81b594b merge with an existing account by using the password 2021-10-14 14:47:50 +02:00
simon lehericey
218e4633a9 securely retrieve fci 2021-10-14 14:47:50 +02:00
simon lehericey
f7299da1e7 launch merge process if an unlinked DS account with the same email exists 2021-10-14 14:47:50 +02:00
simon lehericey
f6879eba60 associate_user take a target email 2021-10-14 14:47:50 +02:00
simon lehericey
09f828a6a2 create_merge_token! 2021-10-14 14:47:50 +02:00
simon lehericey
34862f41e0 Add fci valid_for_merge 2021-10-14 14:47:50 +02:00
simon lehericey
2e118a8f5b allow unattached fci 2021-10-14 14:47:50 +02:00
simon lehericey
461b774188 a password input must not be that wide 2021-10-14 14:47:50 +02:00
simon lehericey
6e6635560f Add merge token to FCI 2021-10-14 14:47:50 +02:00
simon lehericey
6826bf03b0 Sign in with a user linked by france connect sub (openid)
instead of looking linked user by email because :

- follows FC recommendation to fetch ds account by openid
- the email is not a valid key as many user can share the same FCI email.

The following scenario is now working

A user A (email: 1@mail.com) uses FC to connect to DS
=> It is connected as 1@mail.com

Another user B (email: generic@mail.com) uses FC to connect
=> It is connected as generic@mail.com

The first user A change its FC email to generic@mail.com and connect to DS
=> It is still connected as 1@mail.com
2021-10-14 14:47:50 +02:00
simon lehericey
06dee2e023 refactor controller to avoid return 2021-10-14 14:47:50 +02:00