# |
Sep 18th 2019, 10:41 |
adam282 |
If I `echo session_status()` it’s always 2 which means the session is active which it shouldn’t be unless CakePHP executes `session_start()` before the user actually tries to sign in |
# |
Sep 18th 2019, 10:40 |
neon1024 |
As Slack doesn’t have `/collapse` for code :( |
# |
Sep 18th 2019, 10:39 |
adam282 |
Can do. One moment please/ |
# |
Sep 18th 2019, 10:39 |
neon1024 |
I am alive, but you’ve pasted so much code your question has scrolled off my screen. Which makes me wonder if you’d be better served pasting your code using a paste service, which’ll also help the people in IRC who can’t see your code |
# |
Sep 18th 2019, 10:38 |
slackebot |
function isAuthorized($user) { return true; } ``` |
# |
Sep 18th 2019, 10:38 |
slackebot |
'signin' ], 'authError' => false, 'authorize' => ['controller'], 'authenticate' => [ 'Form' => [ 'userModel' => 'Users', 'fields' => [ 'username' => 'email', 'password' => 'password' ] ] ], 'storage' => 'Session' ]); } public |
# |
Sep 18th 2019, 10:38 |
slackebot |
return $this->redirect($this->Auth->redirectUrl()); } $this->Flash->error(__('Invalid username or password')); } $this->set('title', 'Sign In'); $this->viewBuilder()->setLayout('generic'); } ``` ``` Controller/AppController.php public function initialize() { parent::initialize(); $this->loadComponent('RequestHandler', [ 'enableBeforeRedirect' |
# |
Sep 18th 2019, 10:38 |
slackebot |
=> false, ]); $this->loadComponent('Flash'); $this->loadComponent('Auth', [ 'loginAction' => [ 'controller' => 'Users', 'action' => 'signin' ], 'loginRedirect' => [ 'controller' => 'Dashboard', 'action' => 'index' ], 'logoutRedirect' => [ 'controller' => 'Users', 'action' => |
# |
Sep 18th 2019, 10:38 |
slackebot |
Googling and checking Stackoverflow and have not found anything to help me. Any help is appreciated: ``` Controller/UsersController.php public function beforeFilter(Event $event) { parent::beforeFilter($event); $this->Auth->allow(['signin']); } public function signin() { if ($this->request->is('post')) { if ($user = $this->Auth->identify()) { $this->Auth->setUser($user); |
# |
Sep 18th 2019, 10:38 |
adam282 |
I have built multiple applications with CakePHP 2.x but now I am building one with CakePHP 3.x after taking a hiatus and writing API’s with SlimPHP for mobile apps written in Ionic/Cordova/Angular. That being said, I am having an issue with authentication. I keep getting `Session was already started` when trying to sign in. I’ve tried other browsers that have never accessed this app and I get the same thing. I have spent the last hour |
# |
Sep 18th 2019, 10:35 |
adam282 |
Anyone alive? |
# |
Sep 18th 2019, 10:08 |
jotpe |
@steinkel Thanks, but I didn't had the issue ;) |
# |
Sep 18th 2019, 09:56 |
steinkel |
@jotpe check https://api.cakephp.org/3.8/class-Cake.Auth.FallbackPasswordHasher.html for migrating passwords |
# |
Sep 18th 2019, 09:08 |
neon1024 |
Hey everyone |
# |
Sep 18th 2019, 08:48 |
jotpe |
Hi :slightly_smiling_face: |
# |
Sep 18th 2019, 08:48 |
f.greco |
:wave: |
# |
Sep 18th 2019, 08:47 |
jotpe |
except for writing a own UPDATE query |
# |
Sep 18th 2019, 08:46 |
jotpe |
Is there a way to change existing data with migrations? |
# |
Sep 18th 2019, 07:19 |
jotpe |
I guess Cake2x uses Sha by default cand Cake3 bcrypt |
# |
Sep 18th 2019, 07:17 |
admad |
https://book.cakephp.org/3.0/en/controllers/components/authentication.html#changing-hashing-algorithms |
# |
Sep 18th 2019, 07:16 |
admad |
no the default hashing scheme is different in 2 and 3 |
# |
Sep 18th 2019, 07:13 |
kgb.acct.personal |
Is cake3 password hasher same with cake2 password hasher? |
# |
Sep 18th 2019, 07:03 |
jotpe |
Morning |
# |
Sep 18th 2019, 06:59 |
Escw0rm |
Good morning |
# |
Sep 18th 2019, 06:57 |
alexdd55976 |
morning |
# |
Sep 18th 2019, 05:23 |
conehead |
Morning! |
# |
Sep 18th 2019, 04:55 |
javier.villanueva |
morning all |
# |
Sep 18th 2019, 02:10 |
savant |
that seems like it should work, did you also go through the first part of that tutorial? |
# |
Sep 17th 2019, 22:23 |
noel |
Then I tried enabling the Crud API listener and I got this: `Undefined property: CocktailsController::$RequestHandler` |
# |
Sep 17th 2019, 22:08 |
noel |
Firstly the Controller doesn't work, complains about missing Index method. If I bake the controller then that part works and I can browse the data. However the API doesn't work at all. I get an error in the browser of "Cocktails\/json\/index.ctp template file is missing" or via Postman a different error: "Controller class Cocktails could not be found". |
# |
Sep 17th 2019, 22:04 |
noel |
Hi all. Is this out of date? http://www.bravo-kernel.com/2015/04/how-to-use-a-cakephp-3-rest-api/ I can't get it to work at all. |
# |
Sep 17th 2019, 20:07 |
savant |
No worries, I use caps-lock instead of the shift key for capitalization so that happens to me too @rightscoreanalysis |
# |
Sep 17th 2019, 19:49 |
rightscoreanalysis |
sorry for the caps |
# |
Sep 17th 2019, 19:49 |
rightscoreanalysis |
@savant THANKS i FOUND THAT i WAS MISSING THE NAMESPACE AT THE TOP OF MY MODEL CLASS FILE |
# |
Sep 17th 2019, 19:41 |
savant |
since `ArrayObject` has no namespace, you should use `\ArrayObject` or add a `use` statement at the top of the class in question when using it |
# |
Sep 17th 2019, 19:40 |
savant |
@rightscoreanalysis when referencing a class, if you don’t specify a namespace, it will default to the current namespace |
# |
Sep 17th 2019, 19:35 |
admad |
There's no big, you need to improve your knowledge and understanding of namespaces :slightly_smiling_face: |
# |
Sep 17th 2019, 19:32 |
niel45 |
are you sure? looks like they are two different ArrayObjects. One with a name namespace, one without. |
# |
Sep 17th 2019, 19:24 |
rightscoreanalysis |
it is complaining that an ArrayObject should be passed which it reports is being passed :slightly_smiling_face: |
# |
Sep 17th 2019, 19:24 |
rightscoreanalysis |
Argument 2 passed to App\Model\Table\ClassifiedsTable::beforeMarshal() must be an instance of App\Model\Table\ArrayObject, instance of ArrayObject given |
# |
Sep 17th 2019, 19:24 |
rightscoreanalysis |
this looks like a bug to me: |