0
votes

When I used to test $this->Auth->user('id') locally, it works well and the file /app/Config/core has this configuration for Session

Configure::write('Session', array(
        'defaults' => 'cake'
    ));

Now it is hosted on my server, I was noticed that I needed to change that file, so it looks like

Configure::write('Session', array(
        'defaults' => 'php'
    ));

But doing this way, I lost $this->Auth->user('id'), the other fields I can find.

1

1 Answers

0
votes

How did you login the user?

Did you use $this->Auth->login($this->data); ?

If so, the user will be logged in with the data in $this->data and this data will be saved in the session. Try debug($this->Auth->user()); You probably will only see the username (and maybe the password).

To retrieve all the User data on login you need to login without passing data to the AuthComponent.

$this->Auth->login(); will do the magic for you, it will retrieve the user (including the contains) from the database and store this data in the session.

$this->Auth->login(); will only work when $this->data is filled with the right credentials.