Tuesday, December 10, 2013

Re: Cakephp Manual Auth login returns true, but not logged in another page

I found out that $this->Session->Auth array exists and contains correct user data, but debug(AuthComponent::user('id')) returns NULL. Why? 

пятница, 21 июня 2013 г., 2:37:44 UTC+4 пользователь Rahul Reddy написал:
In my cakephp(v 2.3.4) app, I am using the code below to manually login users after they register, as provided in the manual.

if ($this->User->save($this->request->data)) {
    $id = $this->User->id;
    $this->request->data['User'] = array_merge($this->request->data['User'], array('id' => $id));
    if($this->Auth->login($this->request->data['User'])) {
          $this->redirect('/homepage');
    }
}

I am getting the $this->Auth->login($this->request->data['User']) response as true and it is getting redirected to the home page. But the user is not logged in homepage (or in any other page). Please help me in fixing this. Thanks in advance.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: