# |
Dec 31st 2018, 23:23 |
murat |
@challgren I just realized, when an AJAX request is unauthorized, `$this->Auth` returns false and causes `beforeFilter()` to show an error about the failed call to `config()`. |
# |
Dec 31st 2018, 23:16 |
challgren |
I’ll be doing a big PR to fix em all. I’m tired of my logs getting filled from CommonComponent |
# |
Dec 31st 2018, 23:12 |
challgren |
Man @dereuromark the Tools plugin needs a lot of help with the tests! 100+ errors when turning on DEPREACTED warnings |
# |
Dec 31st 2018, 22:54 |
murat |
Thanks a lot :grinning: |
# |
Dec 31st 2018, 22:43 |
challgren |
sweet!! Glad it helped yah! |
# |
Dec 31st 2018, 22:24 |
murat |
This seems to work. ``` public function beforeFilter(Event $event) { if ($this->request->is('ajax')) { $this->Auth->config('unauthorizedRedirect', false); } } ``` |
# |
Dec 31st 2018, 22:13 |
murat |
I'm still working on it. I needed to take a quick break. |
# |
Dec 31st 2018, 22:07 |
challgren |
That work @murat ? |
# |
Dec 31st 2018, 21:43 |
challgren |
might need a $this->Auth->config(‘loginAction’, false); somewhere in there too but again depends on your config |
# |
Dec 31st 2018, 21:42 |
murat |
That's interesting; let me give it a try. |
# |
Dec 31st 2018, 21:41 |
murat |
Oh ok, I was confused because I keep thinking about `isAuthorized` or the action methods. |
# |
Dec 31st 2018, 21:40 |
challgren |
or initialize() |
# |
Dec 31st 2018, 21:40 |
challgren |
Depends on your config but beforeFilter of the AppController |
# |
Dec 31st 2018, 21:40 |
murat |
I'm not sure where I'm supposed to put that. |
# |
Dec 31st 2018, 21:35 |
challgren |
if ($this->getRequest()->is(’ajax) {} |
# |
Dec 31st 2018, 21:35 |
challgren |
$this->Auth->config(‘unauthorizedRedirect’, ‘false’); |
# |
Dec 31st 2018, 21:34 |
murat |
What's the proper to way to prevent redirection for AJAX calls? |
# |
Dec 31st 2018, 21:34 |
murat |
Hey guys, I have a question about AuthComponent. I set it up so that it redirects to the home page upon unauthorized access, but I don't want the redirection to happen when I |
# |
Dec 31st 2018, 18:24 |
challgren |
ModelAwareTrait right? |
# |
Dec 31st 2018, 18:23 |
dereuromark |
adding the trait always works |
# |
Dec 31st 2018, 17:13 |
bobby_1120 |
how to load model into components, cake 3.5 |
# |
Dec 31st 2018, 17:13 |
bobby_1120 |
hi there |
# |
Dec 31st 2018, 16:18 |
NickBusey |
re-installing all the vendor packages now to clear out any edits I may have made |
# |
Dec 31st 2018, 16:18 |
NickBusey |
I have one project working, the other isn't, just gotta compare the two |
# |
Dec 31st 2018, 16:10 |
steinkel |
gist your code, I'll try to help |
# |
Dec 31st 2018, 16:09 |
NickBusey |
Not sure it's the docs at this point, I had it working, then it broke again, heh |
# |
Dec 31st 2018, 16:06 |
steinkel |
ok, if you need to wrestle, we didn't do it right (or we need to improve docs) possibly... |
# |
Dec 31st 2018, 16:05 |
NickBusey |
No problem, wrestling with it now still so I may have some more questions in a bit |
# |
Dec 31st 2018, 16:01 |
steinkel |
sorry I was not around to help when you were having issues with the api token integration, reading the chats now |
# |
Dec 31st 2018, 16:01 |
steinkel |
that's possibly a leftover in the docs as the auth plugin was integrated previously in users |
# |
Dec 31st 2018, 16:00 |
steinkel |
thank you, merged |
# |
Dec 31st 2018, 15:53 |
NickBusey |
Thanks challgren, also I had to change CakeDC/Users to CakeDC/Auth. Submitted a PR to fix the docs |
# |
Dec 31st 2018, 15:06 |
k4t |
thank you for your help, looks like everything iw roking now |
# |
Dec 31st 2018, 15:06 |
k4t |
it could be added to cookbook |
# |
Dec 31st 2018, 15:06 |
k4t |
yeah, I just noticed now that it is possible to use 3rd argument to overwtie where conditions |
# |
Dec 31st 2018, 15:01 |
admad |
@k4t that's cause you are not overwriting, read the API for where() |
# |
Dec 31st 2018, 14:46 |
k4t |
but it is just appending my new conditions so finally I have two Users.id conditions in final query |
# |
Dec 31st 2018, 14:45 |
slackebot |
<k4t> |
# |
Dec 31st 2018, 14:44 |
k4t |
@admad I did: |
# |
Dec 31st 2018, 14:21 |
admad |
@k4t yeah unfortunately those conditions are set after the custom finder is called. So you'll have to use crud's beforeFind event to reset the where() conditions as I showed earlier |
# |
Dec 31st 2018, 13:35 |
k4t |
I thinkthat it should not happen if I choose to pick my own finder |