# |
Dec 21st 2019, 00:41 |
jimbo2150 |
You are thinking of AuthComponent ( https://book.cakephp.org/4/en/controllers/components/authentication.html ) which is deprecated. The authorization and authentication plugins are the way to handle account validation and permissions in 4.0. |
# |
Dec 20th 2019, 23:27 |
luizcmarin |
no deprecated? |
# |
Dec 20th 2019, 23:27 |
luizcmarin |
it's ok ? https://book.cakephp.org/4/en/tutorials-and-examples/cms/authentication-plugin.html |
# |
Dec 20th 2019, 23:27 |
luizcmarin |
hi |
# |
Dec 20th 2019, 22:34 |
challgren |
@devito from https://book.cakephp.org/3/en/controllers/middleware.html#cross-site-request-forgery-csrf-middleware |
# |
Dec 20th 2019, 21:45 |
devito |
@adman in the router?? |
# |
Dec 20th 2019, 21:27 |
admad |
yes, use it's `whitelistCallBack()` method |
# |
Dec 20th 2019, 20:53 |
devito |
is there an easy way to disable csrf middle ware for a particular controller or controller action? |
# |
Dec 20th 2019, 20:48 |
slackebot |
!awesome |
# |
Dec 20th 2019, 20:48 |
slackebot |
Command sent from Slack by latenal: |
# |
Dec 20th 2019, 19:05 |
japerlman |
Did not know that, cool. Thanks! |
# |
Dec 20th 2019, 19:04 |
dsar |
If you don't redirect in your action, POST will be kept in various http requests |
# |
Dec 20th 2019, 19:04 |
japerlman |
I guess I could just do hidden form objects |
# |
Dec 20th 2019, 19:03 |
japerlman |
will my POST data still be in $this->request->data? |
# |
Dec 20th 2019, 19:03 |
japerlman |
I'm using the cakepdf plugin, so I think I need it on the url |
# |
Dec 20th 2019, 18:55 |
dsar |
Or do you need it in the url? |
# |
Dec 20th 2019, 18:53 |
dsar |
`// View` `<?= $this->Form->button(__('Download PDF'), ['name' => 'action', 'value' => 'downloadpdf']) ?>` `// Controller` `if ($this->request->getData('action') === 'downloadpdf') {` `// ...` `}` |
# |
Dec 20th 2019, 18:51 |
dsar |
Just set a name with a value in that submit button and do the stuff in the action |
# |
Dec 20th 2019, 18:45 |
japerlman |
I have a report that generates from POST data, I want the report to render in the view and then in the view have a button that will call the same url but with .pdf at the end of the url to download a PDF of the report. Is there a good ay to do this or should I store my values in a session variable or some other way? |
# |
Dec 20th 2019, 17:24 |
felipe.marinho |
:,) awesome lists |
# |
Dec 20th 2019, 17:23 |
dereuromark |
Awesome, not amazing, but yeah :P |
# |
Dec 20th 2019, 17:22 |
felipe.marinho |
Amazing @dereuromark, just amazing. Thank you. I'll put this list in my main page lol |
# |
Dec 20th 2019, 17:20 |
dereuromark |
@felipe.marinho Did you check this list? :) https://github.com/FriendsOfCake/awesome-cakephp#orm-and-datamapping keyword "row" i would assume |
# |
Dec 20th 2019, 17:19 |
neon1024 |
I’m sure there are better solutions out there though for concurrency |
# |
Dec 20th 2019, 17:19 |
neon1024 |
Then in the afterSave, I’d set it back to `null`. Sure lots of extra IO on the DB, but you’d be certain |
# |
Dec 20th 2019, 17:18 |
neon1024 |
Then if I tried to access it again, I could check and set `$this->Flash->error('Sorry this record is being edited by ' . $user->get('username'))` |
# |
Dec 20th 2019, 17:18 |
neon1024 |
I’d write a locked_by_id to the record when someone loaded it |
# |
Dec 20th 2019, 17:15 |
felipe.marinho |
My friends, what is the correct way to avoid 2 users editing and overwriting the same entity? |
# |
Dec 20th 2019, 15:42 |
slackebot |
Painful. |
# |
Dec 20th 2019, 15:42 |
noel |
Yeah.. I think I found it – it's something weird... basically you know you get the circle icon when you're in device mode for simulating touch and drag etc... well that wasn't appearing.. just the usual arrow instead. I have to switch out of device mode and then back in again before the circle icon will appear. Once the circle icon is there then the event will trigger when I click.. if instead it's just the normal pointer then it won't. |
# |
Dec 20th 2019, 15:41 |
jimbo2150 |
Mobile devices use touch events, `$this->Html->link('<q-icon name="visibility" />', '#', ['escape' => false, 'onclick' => 'edit(event)', 'ontouchend' => 'edit(event)'])` should work. |
# |
Dec 20th 2019, 15:37 |
jotpe |
And the script is rendered properly in the Html Output? |
# |
Dec 20th 2019, 15:24 |
slackebot |
?>"; } <?php $this->Html->scriptEnd(); ``` |
# |
Dec 20th 2019, 15:24 |
noel |
Here's the link: ```$this->Html->link('<q-icon name="visibility" />', '#', ['escape' => false, 'onclick' => 'edit(event)'])``` Here's the script, which is rendered at the bottom of the template: ```<?php $this->Html->scriptStart(['block' => 'vue-component', 'type' => 'text/javascript']); ?> function edit(event) { event.stopPropagation(); window.top.location.href = "<?= Configure::read('deviceUrl').'/enquiry/'.$enquiry->id |
# |
Dec 20th 2019, 15:23 |
noel |
Something weird happening for me. I have a link rendered by the HTML helper with an onclick event. The onclick triggers fine on desktop but not on a device nor device emulator (not even the Chrome standard emulator). Any ideas? |
# |
Dec 20th 2019, 14:34 |
dsar |
A resolver is enough, the authentication plugin has already all the middlewares you need for the authentication management |
# |
Dec 20th 2019, 14:34 |
Naino |
Hi, I would like to sort a query with a belongsToMany association by join table column, is it possible to achieve that with query builder? |
# |
Dec 20th 2019, 14:30 |
luke |
I want to use fusionauth to provide login functionality. I think I need to start with middleware, but will need a resolver |
# |
Dec 20th 2019, 14:30 |
luke |
hmm, thanks, good point |
# |
Dec 20th 2019, 14:21 |
dsar |
The main logic is in the find() method |
# |
Dec 20th 2019, 14:20 |
dsar |
It is a very straightforward class |