Hello everyone,

Do anyone of you have an idea on how to automatically login
after signing-up using Auth Component?

I have tried like:

$this->User->create();
if ($this->User->save($this->data))
{
        $this->Auth->Session->write($this->Auth->sessionKey, $this->User-
>getLastInsertID());
        $this->Session->setFlash('You have successfully logged in.');
        $this->redirect($this->Auth->redirect());
}

Now in my AppController, I have something like this:

<?php
class AppController extends Controller {

        var $components = array('Auth');
        var $helpers = array('Html', 'Form');
        var $uses = array('User');
        function beforeFilter()
        {
                $this->Auth->loginAction = array('controller' => 'users', 
'action'
=> 'login');
                $this->Auth->loginRedirect = array('controller' => 'mainpage',
'action' => 'home');
                $this->Auth->logoutRedirect = array('controller' => 'mainpage',
'action' => 'home');
                $this->Auth->allow('home','signup');
                $this->Auth->authorize = 'controller';
                //$this->Auth->userScope = array('User.confirmed' => '1');
                $this->set('loggedIn', $this->Auth->user('id'));
                $result = $this->User->findById($this->Auth->user('id'));
        }
        function isAuthorized()
        {
                return true;
        }
}
?>

This script is supposed to work but my problem is that $this->Auth-
>user('id') is only returning
the first digit of the number. For example, I have a userid: 53, now
when I will do $this->Auth->user('id'),
it only return "5" instead of "53".

Anyone of you can help me with this?


Thanks,

Mario
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to