Commit Graph

10 Commits

Author SHA1 Message Date
Jan Jakes
71d7f46718 Make captcha session stateless
[MAILPOET-6038]
2024-08-05 13:28:52 +02:00
Jan Jakes
e8cf3d61ef Make captcha phrase stateless
[MAILPOET-6038]
2024-08-05 13:28:52 +02:00
Jan Jakes
10ef9ffce5 Initialize CAPTCHA session and phrase on page load
Previously, a new CAPTCHA phrase was generated when the CAPTCHA image
or audio was requested "again". For that, a counter needed to be stored in the
session, and since image and audio were fetched in parallel, any of them could
initialize the new CAPTCHA phrase. The problem appeared when they both
generated a new phrase at the same time. This resulted in a race condition,
where the image and audio had different CAPTCHA phrases and some users
weren't able to pass the CAPTCHA at all. This was occuring especially in Safari,
(maybe somehow due the type dectection range "preflight" request).

Now, the phrase is initialized on the CAPTCHA page load (and reloaded via AJAX),
so we don't need to store any additional metadata, apart from the phrase itself.

[MAILPOET-6038]x
2024-08-05 13:28:52 +02:00
Jan Lysý
525c80bac4 Fix PHPStan warnings in lib
[MAILPOET-5751]
2023-12-13 11:48:14 +01:00
Jan Jakes
926620e8f8 Ignore strict types rule in all existing files that don't have it
[MAILPOET-2688]
2022-11-29 15:04:09 +01:00
David Remer
f5c678ec2d Initialize session when no ID exists
[MAILPOET-4514]
2022-11-24 09:20:39 +01:00
David Remer
223625bd9b Use constant for endpoint
[MAILPOET-4514]
2022-11-24 09:20:39 +01:00
David Remer
fbd7cf8cc7 Use SubscriberEntity instead of the Model
[MAILPOET-4514]
2022-11-24 09:20:39 +01:00
David Remer
26c7e4d1cc Use null instead of empty string
[MAILPOET-4514]
2022-11-24 09:20:39 +01:00
David Remer
4832771185 Refactor the captcha system
The current Captcha class has a lot of responsibilities. It renders the captcha
image, can check if a certain captcha type is a Google captcha, if a captcha is
required for a certain email. The SubscriberSubscribeController is not only in
charge of "controlling" the subscription process but also validates, whether a
captcha is correct or not. This architecture made it difficult to extend the
functionality and introduce the audio captcha feature.

Therefore this commit refactors the captcha architecture and tries to seperate
the different concerns into several classes and objects. Validation is now done
by validators.

The CaptchaPhrase now is in charge of keeping the captcha phrase consistent
between the image and the new audio, so that you can renew the captcha and both
captchas are in sync.

[MAILPOET-4514]
2022-11-24 09:20:39 +01:00