# |
May 25th 2021, 22:43 |
ljolley |
not sure why. on actions that would fall under the same criteria, the redirect works - but there's no showstoppers in the controller action |
# |
May 25th 2021, 22:43 |
ljolley |
this runs in the beforeFilter but it executes the controller action before the redirect happens |
# |
May 25th 2021, 22:41 |
ljolley |
right. |
# |
May 25th 2021, 22:38 |
greg138 |
`beforeFilter` does run before your controller's action starts. |
# |
May 25th 2021, 22:34 |
ljolley |
looks like the `return` isn't returning? |
# |
May 25th 2021, 22:32 |
ljolley |
working through this some more, it looks like the redirect is triggered, but the page errors out in the controller because it's expecting `$session->read('Admin.organization_id');` Is there a way to force the redirect in the `beforeFilter` before it hits controller logic? |
# |
May 25th 2021, 22:25 |
ljolley |
top redirect under `//REDIRECT TO ORGANIZATION DASHBOARD` works fine. |
# |
May 25th 2021, 22:25 |
slackebot |
== false) { //REDIRECT TO MAIN DASHBOARD $this->Flash->admin_info(__('Not an out action.')); return $this->redirect(['controller'=>'Dashboard','action'=>'main','prefix'=>'Admin']); } }``` |
# |
May 25th 2021, 22:25 |
slackebot |
$this->Flash->admin_info(__('Not an in action.')); return $this->redirect(['controller'=>'Dashboard','action'=>'organization','prefix'=>'Admin']); } } else if(!$session->check('Admin.organization_id')) { //IF UNLOADED $access = $this->Access->actionCheck($this->request->getParam('controller'),$this->request->getParam('action'),'out'); if($access |
# |
May 25th 2021, 22:25 |
ljolley |
``` //CHECK THAT A CONTROLLER AND ACTION IS ACCESSIBLE DEPENDING ON IF THE USER IS LOADED INTO AN ORGANIZATION if($session->check('Admin.organization_id')) { //IF LOADED $access = $this->Access->actionCheck($this->request->getParam('controller'),$this->request->getParam('action'),'in'); if($access == false) { //REDIRECT TO ORGANIZATION DASHBOARD |
# |
May 25th 2021, 22:24 |
ljolley |
I have a check happening in the `AppController` `beforeFilter` and for whatever reason, the redirect doesn't trigger. |
# |
May 25th 2021, 22:23 |
ljolley |
is there anything that would cause a redirect `$this->redirect()` to not work? |
# |
May 25th 2021, 22:10 |
jojomartius |
sounds good @ndm thanks! |
# |
May 25th 2021, 22:09 |
ndm |
@jojomartius That's controlled by the route class. Check your routes config for `setRouteClass()` or `routeClass()` calls, they might be missing, leaving you with the default route class that maps the path as-is. https://github.com/cakephp/app/blob/4.2.2/config/routes.php#L27-L45 |
# |
May 25th 2021, 21:46 |
jojomartius |
Does anybody has an idea what happend and how i can get the lower case routing also working? |
# |
May 25th 2021, 21:44 |
jojomartius |
Hey there, i've a really stupid question. I created a plugin in an existing project with ```bin/cake bake plugin alert``` and a controller with ```bin/cake bake controller companies --plugin alert``` but if I try to access it via the browser on /alert/companies i got nothing, only on /alert/Companies (with a capital C) wir works... |
# |
May 25th 2021, 20:40 |
etibor |
is there a way to display the not permitted character in error message? |
# |
May 25th 2021, 20:40 |
etibor |
okey i actually found, by var_dump the getErrors() |
# |
May 25th 2021, 20:02 |
rightscoreanalysis |
is it hacky to be reading session data in a model? |
# |
May 25th 2021, 19:41 |
etibor |
how the error message will return ? |
# |
May 25th 2021, 19:41 |
etibor |
like this $this->Model->validate('name') |
# |
May 25th 2021, 19:41 |
etibor |
i think its enough to validate a single field, i dont have a lot just 3 |
# |
May 25th 2021, 19:03 |
kevin.pfeifer |
but that doesn’t have anything to do with cakephp so :man-shrugging: |
# |
May 25th 2021, 19:03 |
kevin.pfeifer |
well If you need client side Form Validation I can recommend Parsley |
# |
May 25th 2021, 18:53 |
etibor |
unfortunatly(i have multiple fields for the same model's field and displayed with jquery as the user choose different values from select input) i could not use the same model fields on the form |
# |
May 25th 2021, 18:44 |
kevin.pfeifer |
per field errors are usually defined via the validator present in the tables `validationDefault($validator)` function And if there is an error it is outputted automatically under the field when you use `$this->Form->control('fieldname');` |
# |
May 25th 2021, 18:35 |
etibor |
i created a complex form, with complex funcation calling when i have an error on the form its not possible anymore to show the form input error in the right place i only have the Model->getErrors() but its return an array how can i display the error messeges from there? |
# |
May 25th 2021, 18:33 |
etibor |
hello everyone |
# |
May 25th 2021, 16:41 |
admad |
It's likely someone might maintain is as a separate plugin :). |
# |
May 25th 2021, 16:40 |
admad |
Unless stated otherwise always assume that a deprecated feature will be removed in next major. |
# |
May 25th 2021, 15:14 |
neon1024 |
Yes, good spot, thanks |
# |
May 25th 2021, 14:53 |
ndm |
The migration guide says that it will be removed in 5.x, but that's the only place that mentions a version AFAICT. https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html#component |
# |
May 25th 2021, 14:46 |
neon1024 |
I assumed 5.x as it’s deprecated now in 4.x |
# |
May 25th 2021, 14:46 |
neon1024 |
Anyone know when AuthComponent is being removed? I don’t see it on the 5.x roadmap |
# |
May 25th 2021, 10:57 |
neon1024 |
Convoluted but okay |
# |
May 25th 2021, 10:56 |
neon1024 |
ArrayAccess |
# |
May 25th 2021, 10:56 |
neon1024 |
Ah, EntityInterface implements |
# |
May 25th 2021, 10:56 |
neon1024 |
Or is an Entity \ArrayAccess? |
# |
May 25th 2021, 10:55 |
neon1024 |
Have I misconfigured something? I am using the `Authentication.Session` Authenticator, with the Form one for login, and an `auth` finder in my `UsersTable` |
# |
May 25th 2021, 10:54 |
neon1024 |
How do I get a consistent type return from Authentication? I am trying `$this->Authentication->getIdentity()->getOriginalData()` (the component), and the method return type is marked as `@return \ArrayAccess|array` but when I dump it in my controller it’s `App\Model\Entity\User Object` |
# |
May 25th 2021, 10:50 |
ndm |
https://stackoverflow.com/questions/62713730/why-is-the-callback-identifier-not-being-invoked/62718515#62718515 |