Tuesday, May 31, 2011

Re: Static Username

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


On May 31, 10:02 am, Jeremy Burns | Class Outfit
<jeremybu...@classoutfit.com> wrote:
> Why are you doing this through a form? You can just do:
>
> $user = $this->User->findByUsername('xxx');
> $this->Auth->login($user);
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 31 May 2011, at 16:57, Jacob wrote:
>
> > I am attempting to create a login.ctp page that takes the username and
> > password from global environment variables and automatically performs
> > a login. I can't seem to figure out how to make an input form accept
> > "static text" rather than creating an input box.
>
> >        <h2>Login</h2>
> >        <?php
> >        $user = getenv('user');
> >        $pass = getenv('pass');
> >                echo $form->create('User', array('url' =>
> > array('controller' => 'users', 'action' =>'login')));
> >                echo $form->input('User.username', array($user));
> >                echo $form->input('User.password', array($pass));
> >                echo $form->end('Login');
> >        ?>
>
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: