So far, this is the code I have in my users_controller

        $username = getenv('USER');
        $user = $this->User->findByUsername($username);
        $this->Auth->login($user);

Unfortunately I can't find a way to force home.ctp to make the user
login without removing the display line from my app controller.

        $this->Auth->allowedActions = array('display');

When I remove this line it is unable to load home.ctp. I need the page
to load inorder to use getenv('USER');
Does anyone know the syntax to force the login function but keep
home.ctp available?



On Jun 1, 6:33 am, Jon Bennett <[email protected]> wrote:
> > Notice (8): Undefined property:  View::$Auth [APP/views/pages/
> > home.ctp, line 16]
> > Fatal error: Call to a member function login() on a non-object
>
> > Does your code have to be placed in a controller? I'm trying to
> > include it in home.ctp
>
> Auth is a component, so yep, as a controller extension it is only
> available inside the controller. As a Mike suggested, you can find the
> user and log them in from the controller without a http post request,
> or you could even just recreate the session that auth expects and then
> redirect to another page (not login though).
>
> hth
>
> j
>
> --
> jon bennett -www.jben.net- blog.jben.net

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to