Tuesday, May 31, 2011

Re: Static Username

> 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');
> ?>
>

try setting the value:

echo $form->input('User.username', array('value'=>$user));
echo $form->input('User.password', array('value'=>$pass));

TBH unless you are using javascript to automatically submit this form, you
would be better off having a controller action that reads in the username
and password and then redirects to the login action.

Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mikek@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel: 07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

--
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: