Add check that resize was called from correct domain

[MAILPOET-2811]
This commit is contained in:
Rostislav Wolny
2020-05-23 15:59:57 +02:00
committed by Veljko V
parent 7a9f605fb4
commit 0039dec079
7 changed files with 26 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ class PreviewPage {
$this->assetsController = $assetsController;
}
public function renderPage(int $formId, string $formType): string {
public function renderPage(int $formId, string $formType, string $editorUrl): string {
$this->assetsController->setupFormPreviewDependencies();
$formData = $this->fetchFormData($formId);
if (!is_array($formData)) {
@@ -49,7 +49,7 @@ class PreviewPage {
'form/form_preview.html',
[
'post' => $this->getPostContent(),
'form' => $this->getFormContent($formData, $formId, $formType),
'form' => $this->getFormContent($formData, $formId, $formType, $editorUrl),
'formType' => $formType,
]
);
@@ -81,10 +81,11 @@ class PreviewPage {
return null;
}
private function getFormContent(array $formData, int $formId, string $formDisplayType): string {
private function getFormContent(array $formData, int $formId, string $formDisplayType, string $editorUrl): string {
$htmlId = 'mailpoet_form_preview_' . $formId;
$templateData = [
'is_preview' => true,
'editor_url' => $editorUrl,
'form_html_id' => $htmlId,
'form_id' => $formId,
'form_success_message' => $formData['settings']['success_message'] ?? null,