Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
A registration form may have newsletter information or be guarded by reCaptcha. In a decoupled scenario this is almost impossible to handle since we cannot just alter the form and its submission. Having an event that passed the account to be created and the resource document would allow this.
A client could pass reCaptcha data in the request document's meta properties and then a subscriber to the event could validate the information.
Comment | File | Size | Author |
---|---|---|---|
#8 | 3104957-8.patch | 14.65 KB | mglaman |
#7 | 3104957-6.patch | 14.35 KB | mglaman |
#5 | 3104957-5.patch | 7.71 KB | mglaman |
#2 | 3104957-2.patch | 4.81 KB | mglaman |
Comments
Comment #2
mglamanSlight problem:
To run this before the user is saved, we need to run it in
modifyCreatedEntity
. Which we don't have access to the JSON:API document.Instead of rewriting everything, maybe modifyCreatedEntity should also pass the document data along with the request.
Comment #3
mglamanPostponing on #3104972: Move extracting documents from request objects to a service which makes this a lot easier.
Comment #4
mglamanjsonapi_resources 1.0-beta3 landed with the required code!
Comment #5
mglamanHere is an updated patch that retrieves the document from the request.
Comment #6
mglamanThis adds tests. Also has pending test coverage for metadata support once #3105792: Add support for the meta property lands.
Comment #7
mglamanComment #8
mglamanFixes up phpcs
Comment #10
mglaman