# |
Sep 18th 2019, 11:05 |
adam282 |
Weird. Commenting that out still shows `Session Status: 2` |
# |
Sep 18th 2019, 11:03 |
adam282 |
The ONLY `session_start` that exists in my entire code base including `vendor` is ``` if (!session_start()) { throw new RuntimeException('Could not start the session'); } ``` |
# |
Sep 18th 2019, 11:03 |
adam282 |
Tried it already |
# |
Sep 18th 2019, 11:02 |
Escw0rm |
Maybe this is worth checking out: https://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies |
# |
Sep 18th 2019, 11:00 |
adam282 |
Makes absolutely no sense |
# |
Sep 18th 2019, 10:59 |
Escw0rm |
Yes |
# |
Sep 18th 2019, 10:59 |
adam282 |
Do you see `Session Status: 2`? |
# |
Sep 18th 2019, 10:59 |
adam282 |
https://buildware.projects.elasty.co/users/signin |
# |
Sep 18th 2019, 10:58 |
adam282 |
I have removed all temp session files on the server as well |
# |
Sep 18th 2019, 10:58 |
adam282 |
No `session_start`’s exist in `srv/*` |
# |
Sep 18th 2019, 10:57 |
adam282 |
Evening with switching it to use the database I still get the same error |
# |
Sep 18th 2019, 10:54 |
Escw0rm |
I would try to search for all session_start and remove them temp. Then destroy all sessions and try echo session_status() again |
# |
Sep 18th 2019, 10:52 |
adam282 |
App won’t be able to access the AWS RDS from local server |
# |
Sep 18th 2019, 10:51 |
Escw0rm |
Remove all session_start, destroy all session and echo session_status() |
# |
Sep 18th 2019, 10:51 |
admad |
Do you get same error locally? |
# |
Sep 18th 2019, 10:51 |
adam282 |
Nope, definitely not |
# |
Sep 18th 2019, 10:50 |
admad |
You are maybe including some 3rd party script which is triggering the session start before hand |
# |
Sep 18th 2019, 10:48 |
adam282 |
Hm, nope that didn’t fix it. |
# |
Sep 18th 2019, 10:48 |
conehead |
You should try that on a local machine. |
# |
Sep 18th 2019, 10:46 |
adam282 |
Oh fuck me |
# |
Sep 18th 2019, 10:45 |
neon1024 |
Not too sure, apologies. I would checkout the PHP configuration. I’ve never experienced that issue myself |
# |
Sep 18th 2019, 10:44 |
adam282 |
Nah, just on the server right now |
# |
Sep 18th 2019, 10:44 |
neon1024 |
Are you storing your sessions on S3? |
# |
Sep 18th 2019, 10:43 |
adam282 |
Via an AWS EC2 instance that has CakePHP 2.x apps running without an issue |
# |
Sep 18th 2019, 10:43 |
adam282 |
NGINX + PHP-FPM |
# |
Sep 18th 2019, 10:42 |
neon1024 |
Are you running your application on a local webserver? Or `bin/cake server`? |
# |
Sep 18th 2019, 10:42 |
adam282 |
Yeah, neither do I! LoL |
# |
Sep 18th 2019, 10:42 |
neon1024 |
I don’t see any issues with the code |
# |
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 |