Regenerate CAPTCHA phrase using a custom request with cachebust to avoid caching

[MAILPOET-6038]
This commit is contained in:
Jan Jakes
2024-07-30 15:36:12 +02:00
committed by Aschepikov
parent 758cb09a77
commit ee6e22efa3
5 changed files with 52 additions and 5 deletions

View File

@@ -13,6 +13,7 @@ class Subscription {
const ACTION_CAPTCHA = 'captcha';
const ACTION_CAPTCHA_IMAGE = 'captchaImage';
const ACTION_CAPTCHA_AUDIO = 'captchaAudio';
const ACTION_CAPTCHA_REFRESH = 'captchaRefresh';
const ACTION_CONFIRM = 'confirm';
const ACTION_MANAGE = 'manage';
const ACTION_UNSUBSCRIBE = 'unsubscribe';
@@ -23,6 +24,7 @@ class Subscription {
self::ACTION_CAPTCHA,
self::ACTION_CAPTCHA_IMAGE,
self::ACTION_CAPTCHA_AUDIO,
self::ACTION_CAPTCHA_REFRESH,
self::ACTION_CONFIRM,
self::ACTION_MANAGE,
self::ACTION_UNSUBSCRIBE,
@@ -82,6 +84,14 @@ class Subscription {
exit;
}
public function captchaRefresh($data): void {
$captchaSessionId = $data['captcha_session_id'] ?? null;
if (!$captchaSessionId) {
return;
}
$this->captchaRenderer->refreshPhrase($captchaSessionId);
}
public function confirm($data) {
$subscription = $this->initSubscriptionPage(UserSubscription\Pages::ACTION_CONFIRM, $data);
$subscription->confirm();