Log message #4266560

# At Username Text
# Jun 25th 2021, 16:37 ricmelero that's why it matchs
# Jun 25th 2021, 16:37 ricmelero sorry, it's like this "/{lang}/{controller}/{action}/*"
# Jun 25th 2021, 16:34 admad > /es/admin/users/view/1 is matching with /{lang}/{controller}/{action} @ricmelero I don't see how that's possible since your URL has 4 parts while the route has just 3 (and there's no `/*` at the end). And even if that's the case just connect your routes for admin prefix earlier.
# Jun 25th 2021, 16:25 nick.vanderwoude @ndm That's good advice, thanks. I was able to make some progress from newing up my own new Response object in the controller and returning that. It prevents the api endpoint from getting redirected, which is better, but I am still having issues getting the data out on the front end
# Jun 25th 2021, 16:10 slackebot whatever you want. But since that's coming from someone who's not familiar with the plugin, take it with a grain of salt.
# Jun 25th 2021, 16:10 ndm @nick.vanderwoude I'm not overly familiar with the plugin, but looking at the code, the redirects seem pretty much hardcoded. https://github.com/CakeDC/users/blob/master/src/Controller/Component/LoginComponent.php#L145 You could probably provide a custom `login()` action, require the trait's method in an aliased fashion, invoke it manually and extract the required information from the returned response, then you can do with it
# Jun 25th 2021, 16:09 ricmelero I was debbuging and I saw that all routes ended up under "/" path in the routes collection, so the revert sorting to move longer paths first, does nothing, and inside that path, plugin routes are added after, so is matching the shorter first, without plugin prefix
# Jun 25th 2021, 16:06 slackebot way.
# Jun 25th 2021, 16:06 ricmelero @admad I'm using your i18n routing plugin, in a cakephp 4 project, and I'd isolated roles within plugins, and I having issues with routing: for example /es/admin/users/view/1 is matching with /{lang}/{controller} /{action} instead of /{lang}/admin/{controller}/{action} Sorry to bother you directly, but I just want to know if it you have used with plugins, if there is something extra to do or if just doesn't suppose to work this
# Jun 25th 2021, 16:01 staccato123 Thanks all. I have now got it throwing errors in my code instead of its code ;) plus it's five o'clock so excellent timing! Have a good weekend, all
# Jun 25th 2021, 15:53 nick.vanderwoude how can I interrupt this login action so I can handle the redirect on the front end?
# Jun 25th 2021, 15:52 nick.vanderwoude the problem is that the 302 redirect occurs, so when the response gets back to the front end it's a 500 because the 302 redirected to the next location before it returned
# Jun 25th 2021, 15:52 nick.vanderwoude This works correctly: when I hit the endpoint it correctly logs in the user with the credentials i sent in a form
# Jun 25th 2021, 15:51 nick.vanderwoude Hi all! I am looking for some support. I am working on setting up a custom React front end to handle log ins. I am connecting to a custom API endpoint that calls the login() action on the LoginTrait of the CakeDC auth plugin
# Jun 25th 2021, 15:41 staccato123 They're very short anyway
# Jun 25th 2021, 15:41 staccato123 @admad will do
# Jun 25th 2021, 15:04 greg138 Inquiring minds want to know...
# Jun 25th 2021, 15:01 admad *them then
# Jun 25th 2021, 15:01 admad staccato123: if you are going to rewrite them them better write them as commands, shells have been deprecated :)
# Jun 25th 2021, 14:59 tyler.adam.lazenby thanks anyways
# Jun 25th 2021, 14:59 tyler.adam.lazenby I figured it out
# Jun 25th 2021, 14:58 greg138 I mean, for example, when you create the encoded string to post, if that was happening inside an anonymous function and referencing a variable that doesn't exist in that context, then what it encodes to would legit be a blank string, and then what your controller receives would be exactly right.
# Jun 25th 2021, 14:57 staccato123 @ndm my imported shells are super small so I have just deleted them for now and I will rewrite them when the main app is working. That's helped, thanks
# Jun 25th 2021, 14:57 tyler.adam.lazenby That the $this->getBody()->getContents() wasn't going to get what was passed
# Jun 25th 2021, 14:56 greg138 Any chance that some part of [the decode / encode process] is failing to give what you expect?
# Jun 25th 2021, 14:56 tyler.adam.lazenby and no I did eventually figure out what it was
# Jun 25th 2021, 14:56 tyler.adam.lazenby you had another question lol... sorry I scrolled way down
# Jun 25th 2021, 14:55 greg138 And my second question?
# Jun 25th 2021, 14:48 staccato123 @ndm thanks, I will look into that
# Jun 25th 2021, 14:38 tyler.adam.lazenby @greg138 Its because I have to hmac_hash and base_64 encode it
# Jun 25th 2021, 14:27 slackebot therefore neither be be in `/src/Shell/AppShell.php`, not should it have a `Shell` suffix. You have to manually intervene there, either you stick with the shell, then the namespace should be `App\Shell` and the file should be `/src/Shell/AppShell.php`, or you transform it into a command, then the namespace should be `App\Command`, the classname should be `AppCommand`, and the file should be `/src/Command/AppCommand.php`.
# Jun 25th 2021, 14:27 ndm staccato123: That message looks like the namespace and classname do not match the filename, hence the `class_exists()` checks fail, causing the autoloader to try to include the file over and over again. `App\Console\Command\AppShell` is completely wrong, the `Console` and `Command` subnamespaces are two different things, commands go in `App\Command`, not in `App\Console\Command`. In any case a command is not a shell, and should
# Jun 25th 2021, 13:48 kevin.pfeifer the only experience I have is with going from 3 to 4 where also the upgrade tool (based on rector) can be quite finicky to setup
# Jun 25th 2021, 13:46 staccato123 Thanks for trying
# Jun 25th 2021, 13:45 kevin.pfeifer sorry, I can't tell you more here because I never upgraded a cake2 app to 3 ,:) You will have to wait till someone else can maybe help you
# Jun 25th 2021, 13:43 staccato123 I was expecting some problems with the upgrade system, I wasn't expecting it to just not run at all
# Jun 25th 2021, 13:43 staccato123 It isn't huge, but more the point I'm using it as practice for another, much more involved one later
# Jun 25th 2021, 13:41 kevin.pfeifer or if your app isn't that large I would personally just redo everything in cake 4 :)
# Jun 25th 2021, 13:41 staccato123 Exception: Class 'App\Console\Command\AppShell' not found in [/path/to/application/src/Shell/CategoryShell.php, line 4]
# Jun 25th 2021, 13:41 staccato123 I have done that once, but granted I've started again since then. I will again.
# Jun 25th 2021, 13:39 kevin.pfeifer I would also recommend to check your now "transformed" new app with the default cakephp 3 app template https://github.com/cakephp/app/tree/3.x And see where there are differences