# |
Feb 8th 2018, 20:23 |
kevin |
its just this crappy little if/else statement right now. I dont like that a ton. |
# |
Feb 8th 2018, 20:21 |
kevin |
so right now, I have a default.ctp, and I’m checking to see if the user is logged in. If yes, I display one default.ctp, if no, I display a different one. Is there a better way to do this? like one default.ctp for auth’d vs another for unauth’d? |
# |
Feb 8th 2018, 20:19 |
kevin |
thats @alysson-azevedo!!! That did the trick for me. I wasnt looking at $rules. I was trying to do it through validation. |
# |
Feb 8th 2018, 19:39 |
sayed |
File uploaded https://cakesf.slack.com/files/U8SE5F2NN/F964M9EHZ/screen_shot_2018-02-08_at_20.34.31.png / https://slack-files.com/T053DPNCM-F964M9EHZ-f72efd5ed8 |
# |
Feb 8th 2018, 19:39 |
sayed |
thats why i was getting the error while trying to clear cache |
# |
Feb 8th 2018, 19:39 |
sayed |
nevermind, found the issue, apcu (for the cli) was running on a different build of the php version |
# |
Feb 8th 2018, 19:34 |
sayed |
I tried a composer reinstall but still the same error |
# |
Feb 8th 2018, 19:34 |
sayed |
@bravo-kernel I can see here https://github.com/cakephp/cakephp/issues/8896 that you had the same issue as i have now |
# |
Feb 8th 2018, 19:33 |
alysson-azevedo |
check cakedc/users https://github.com/CakeDC/users/blob/master/src/Model/Table/UsersTable.php |
# |
Feb 8th 2018, 19:21 |
kevin |
I cant seem to find anything to specifically assist with that |
# |
Feb 8th 2018, 19:21 |
kevin |
cake 3.5 |
# |
Feb 8th 2018, 19:21 |
kevin |
Is anyone aware of a good guide on how to perform data validation on a signup page, including verifying whether a user already exists or not? |
# |
Feb 8th 2018, 18:47 |
sayed |
thanks once again ! |
# |
Feb 8th 2018, 18:46 |
sayed |
no it is exactly what i needed |
# |
Feb 8th 2018, 18:46 |
hmic |
if it's not perfectly up to your case, you get at least a bunch of ideas |
# |
Feb 8th 2018, 18:46 |
hmic |
but throttle is the thing to look into |
# |
Feb 8th 2018, 18:46 |
hmic |
thats why i asked ;-) |
# |
Feb 8th 2018, 18:45 |
sayed |
wrong term |
# |
Feb 8th 2018, 18:45 |
sayed |
oke sure my bad |
# |
Feb 8th 2018, 18:45 |
sayed |
Thanks guys |
# |
Feb 8th 2018, 18:45 |
hmic |
which is stupid. especially for a webserver |
# |
Feb 8th 2018, 18:45 |
hmic |
not "block concurrent" |
# |
Feb 8th 2018, 18:45 |
hmic |
yeah. throttle |
# |
Feb 8th 2018, 18:44 |
sayed |
Wel lets say i have an Api with an Endpoint, the client who is trying to submit data has a ‘retry mechanism’ which just goes crazy, so my log files are over 6 mb in like a couple of minutes. So basically i would like to block them after 200+ requests from which they get denied |
# |
Feb 8th 2018, 18:44 |
bravo-kernel |
@sayed https://github.com/UseMuffin/Throttle |
# |
Feb 8th 2018, 18:42 |
hmic |
why would you want that? |
# |
Feb 8th 2018, 18:42 |
sayed |
Guys, anyone with a good idea on how to block concurrent requests to the server, with cake of course. |
# |
Feb 8th 2018, 17:59 |
pedroseco |
ok só um probably doing something wrong on my "listen" part |
# |
Feb 8th 2018, 17:51 |
hmic |
and thats all you need to do. listen to the event you emit. does not matter which plugin or app does what exactly. just match the events name and make sure to listen before emitting it (and the correct eventmanager is involved, usually go for the global one and attach early (bootstrap.php)) |
# |
Feb 8th 2018, 17:49 |
hmic |
pedroseco: you dont access events, you listen to them |
# |
Feb 8th 2018, 17:37 |
pedroseco |
what's the best way to share a callback from a event between all my plugins? Ex acessing from PLugin X a particular event emitted by Plugin Y |
# |
Feb 8th 2018, 16:52 |
jotpe |
I tried something like `$this->assertResponseFailure($result = $this->Flash->render('custom5'));` but phpunit just tells me, that there was an error ;) |
# |
Feb 8th 2018, 16:51 |
jotpe |
Hey guys! How can i write a Test, if a method rises a UnexpectedValueException? |
# |
Feb 8th 2018, 16:46 |
spencdev |
What doesn’t lol. I’m fighting with the 7.1 tempnam notices |
# |
Feb 8th 2018, 16:39 |
neon1024 |
Nah, I’m using multidimensional arrays which upsets PHP apparently |
# |
Feb 8th 2018, 16:38 |
spencdev |
When you use their example? |
# |
Feb 8th 2018, 16:33 |
neon1024 |
Then you get, `: Indirect modification of overloaded element of ArrayObject has no effect [` |
# |
Feb 8th 2018, 16:33 |
neon1024 |
`The $data parameter is an ArrayObject instance, so you don't have to return it to change the data used to create entities.` |
# |
Feb 8th 2018, 16:33 |
neon1024 |
I like the docs stating this, https://book.cakephp.org/3.0/en/orm/saving-data.html#modifying-request-data-before-building-entities |
# |
Feb 8th 2018, 16:32 |
spencdev |
Another way, and it could quite possibly be really bad advice, is to use Events. As a last ditch effort to kind of duct tape it together, you could make an event and in your non-plugin model/controller have it fire an event to check if everything saved properly. That may be over engineering something, and like I said, could quite possibly be really bad advice. Take it for what its worth. |
# |
Feb 8th 2018, 16:29 |
spencdev |
Yeah, you can. There are a thousand ways to skin this cat. There isn’t a right or wrong way, except ways that just don’t work. But with the plugins, I’m not sure if you can attach behaviors to models in plugins. I could be wrong though, i’ve never done it. |