Why not use the session helper in the default.ctp ?

if($session->check('Auth.User.id'))
    echo "User is logged";
else
      echo "Not logged" ..


On Sep 10, 7:38 pm, cricket <[email protected]> wrote:
> On Fri, Sep 10, 2010 at 11:23 AM, Chuck <[email protected]> wrote:
> > OK, after assistance from the group with setting up Auth, I'm not
> > trying to test if a user is logged in or not. Before testing this, the
> > behavior of the system is as follows.
>
> > 1. The login form appears at the top of every page except the users/
> > login page.
> > 2. If I attempt to login with incorrect credentials, the form takes me
> > to users/login with an error message.
> > 3. If I login with valid credentials, the form forwards me to pages/
> > home..
>
> > Given the above, it appears the login is working, so the next step is
> > to figure out if the user is logged in or not, so I added the
> > following to AppController:
>
> > if ( $this->Auth->user() ) {
> >  $this->set( 'loggedin', 'the user is logged in' );
> > } else {
> >  $this->set( 'loggedin', 'the user is not logged in' );
> > }
>
> > Then in the default.ctp file, just above the login form, I placed the
> > following:
>
> > echo  $loggedin;
>
> > No matter whether I use valid or invalid credentials, this always come
> > back, "the user is not logged in".`
>
> > Where is my mistake?
>
> > Thanks,
> > Chuck
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Cached content?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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