richardhj / contao-ajax_reload_element

AjaxReloadElement for Contao Open Source CMS
GNU Lesser General Public License v3.0
14 stars 5 forks source link

Newsletter Confirmation-Mail #2

Closed manjarco closed 6 years ago

manjarco commented 7 years ago

When using the ajax-reload with the standard newsletter-subscription-module the link in the confirmation-e-mail gets altered to something like this:

http://example.com/SimpleAjaxFrontend.php?action=reload-element&element=mod%3A%3A6&auto_item=&page=2&REQUEST_TOKEN=73e071a55effead3446a534fae72c60e&token=a6896a0636d0c607832ad83d0479508f

… which is unusable and produces an error.

richardhj commented 7 years ago

As you can see in the ModuleSubscribe.php this is how the link is generated:

$arrData['link'] = \Idna::decode(\Environment::get('base')) . \Environment::get('request') . ((\Config::get('disableAlias') || strpos(\Environment::get('request'), '?') !== false) ? '&' : '?') . 'token=' . $strToken;

It is true, that Environment::get('request') outputs SimpleAjax.php instead of the "right" uri, because the SimpleAjax.php handles the content element. I see two approaches: Overriding the class ModuleSubscribe or manipulating the Environment variables. I am not ok with any of them because approach 1 is disproportionate and approach 2 most likely will influence other components. Not using the ajax reload for the NewsletterSubscribe and RegistrationForm are the best solution as far as I can see.

manjarco commented 7 years ago

Well, ok then. Thanks anyway!

richardhj commented 7 years ago

I decided to set the request environment variable in e850a0d Stay tuned, maybe it will be integrated in of the next releases

richardhj commented 6 years ago

@manjarco version 2.0 does it better