Score:1

Allow access to Webform form URL only through Ajax

in flag

I'm using Webform to create some forms, those forms must be showed in modal through Ajax, and all of this is working good.

The issue is that I need URL to the form in order to load the form in modal, but I need to deny access to the form URL and allow it only through Ajax.

So, if user try to get /forms/my-form to get 403, and if I get the same URL in Webform Ajax Modal to allow it.

Any idea how to achieve this?

id flag
Are there distinct headers in the Ajax requests? If not, this is impossible. Are you already implementing alterations to Webform’s routes, to insert your access controls?
4uk4 avatar
cn flag
There is a trait for that /core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.