# |
Dec 26th 2019, 00:36 |
challgren |
https://book.cakephp.org/4/en/controllers/middleware.html#cross-site-request-forgery-csrf-middleware |
# |
Dec 26th 2019, 00:35 |
ashesh.social |
@challgren 4 |
# |
Dec 26th 2019, 00:35 |
challgren |
@ashesh.social 4 or 3? |
# |
Dec 26th 2019, 00:34 |
ashesh.social |
@challgren tried whitelisting with many resources from google. Not working out. |
# |
Dec 26th 2019, 00:34 |
challgren |
The initial error, the transport I think in debug/phpunit mode its overwritten |
# |
Dec 26th 2019, 00:33 |
ndm |
Yeah, but transports don't have static methods, so that should work fine... or are you referring to the initial error mocking the mailer? |
# |
Dec 26th 2019, 00:32 |
challgren |
Because you cant mock static methods |
# |
Dec 26th 2019, 00:32 |
ndm |
Not sure how that would interfere, but everything's possible :) |
# |
Dec 26th 2019, 00:31 |
challgren |
I'm probably just going to have to make a errorable transport or mailer |
# |
Dec 26th 2019, 00:30 |
challgren |
@ndm I believe all my issues are because of the staticconfigtrait |
# |
Dec 26th 2019, 00:29 |
challgren |
Your probably going to have to whitelist that action from the gateway |
# |
Dec 26th 2019, 00:29 |
ndm |
If you can't pass over the token to the gateway and have it return it accordingly when it posts to your API (not sure if that really makes much sense in the first place though, given that I'd expect that endpoint to only accept one way or another "signed" requests), then you'll probably have to disable CSRF for that specific endpoint. |
# |
Dec 26th 2019, 00:11 |
ashesh.social |
“Missing CSRF token body ...” this is the error |
# |
Dec 26th 2019, 00:10 |
ashesh.social |
But facing issue in the redirect URL of my payment gateway return POST to my method |
# |
Dec 26th 2019, 00:10 |
ashesh.social |
So the CSRF is working all around the application through ajax and also in form POST |
# |
Dec 25th 2019, 20:44 |
ashesh.social |
Thanks :raised_hands::skin-tone-3: |
# |
Dec 25th 2019, 18:30 |
ndm |
Means your form is missing the token, which should be added automatically when using the form helper. Check the generated HTML. |
# |
Dec 25th 2019, 18:24 |
ashesh.social |
In cakephp 4 |
# |
Dec 25th 2019, 18:24 |
ashesh.social |
But now it’s during form POST |
# |
Dec 25th 2019, 18:24 |
ashesh.social |
“Missing CSRF token body in /usr/local/myapp/vendor/cakephp/cakephp/src/Http/Middleware/CsrfProtectionMiddleware.php on line 234” |
# |
Dec 25th 2019, 18:04 |
ndm |
Oh well, maybe if there's something in your `contactUs()` method that overrides the transport |
# |
Dec 25th 2019, 18:03 |
ndm |
@challgren Sorry, had to have a chat with my neighbours about drill and sledgehammer powered home improvement work on christmas day's evening. I don't see anything inherently wrong with the code, if the mailers `deliver()` method is being reached, then I'd expect this to work. |
# |
Dec 25th 2019, 17:08 |
challgren |
Can't mock the mailer or set the transport |
# |
Dec 25th 2019, 17:05 |
slackebot |
<challgren> |
# |
Dec 25th 2019, 17:03 |
challgren |
That sets Email so I could mock it |
# |
Dec 25th 2019, 17:03 |
challgren |
getMailer is called on construct |
# |
Dec 25th 2019, 17:02 |
challgren |
Email is the mailer |
# |
Dec 25th 2019, 17:02 |
ndm |
I don't really know what's happening in `QueueCustomEmail`, so it's hard to tell, but if it's not called, then it's probably not the transports fault |
# |
Dec 25th 2019, 17:00 |
slackebot |
<challgren> |
# |
Dec 25th 2019, 16:59 |
challgren |
1) App\Test\TestCase\Shell\Task\QueueCustomEmailTaskTest::testRunFailure Expectation failed for method name is “send” when invoked 1 time(s). Method was expected to be called 1 times, actually called 0 times. |
# |
Dec 25th 2019, 16:59 |
challgren |
And @ndm mocked transport doesn’t work :( |
# |
Dec 25th 2019, 16:58 |
slackebot |
<ndm> |
# |
Dec 25th 2019, 16:58 |
ndm |
Totally different question, why do the CakePHP docs try to bamboozle poor meth users? |
# |
Dec 25th 2019, 16:49 |
challgren |
Figured this was gonna be an easy switch but seems like a bit got shuffled around |
# |
Dec 25th 2019, 16:49 |
challgren |
Ahh ok that makes sense. Just trying to learn the new methodology |
# |
Dec 25th 2019, 16:48 |
admad |
A trait which you use in your mailer |
# |
Dec 25th 2019, 16:46 |
challgren |
Ok so heres a question, the mailgun plugin has a couple convience functions that allow setting headers but without the all X-Mailgun-* wheres the best way to implement that now in the Message class or Mailer class? |
# |
Dec 25th 2019, 16:36 |
ndm |
no problem |
# |
Dec 25th 2019, 16:36 |
admad |
@ndm thanks for the doc update |
# |
Dec 25th 2019, 16:32 |
challgren |
But the exception makes more sense now to figure out how to semver a release back to prerelease and add the beta tag |
# |
Dec 25th 2019, 16:30 |
challgren |
No try { in https://book.cakephp.org/4/en/core-libraries/email.html |