Now I cannot authenticate. Just simple authentication only for now.
AFAIK Auth is supposed to automagically check columns username &
password in the table. Yet it doesn't work. Here's what I do: visit
example.org/, get redirected to example.org/login, enter valid
username & pass, and get the same login URL with flash error: "Invalid
username or password, try again". No SQL queries get logged as far as
I can tell (debug>0).
Model/Milli.php is empty
class MilliController extends AppController
{
public $paginate = array('limit' => 5);
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' =>
'milli', 'action' => 'index'),
'logoutRedirect' => array('controller' =>
'milli', 'action' => 'index'),
'authenticate' => array('Form'),
'loginAction' => array('controller' =>
'milli', 'action' => 'login')));
public function beforeFilter() {
#parent::beforeFilter();
$this->Auth->allow('login', 'logout');
#$this->Auth->allow('*');
}
public function login() {
if ($this->request->isPost()) {
if ($this->Auth->login()) {
$this->redirect($this->Auth-
>redirect());
} else {
$this->Session->setFlash(__('Invalid
username or password, please try again'));
}
}
}
public function logout() {
$this->redirect($this->Auth->logout());
}
public function index() {
}
}
View/Milli/login.ctp:
<div class="users form">
<?php echo $this->Session->flash('auth'); ?>
<?php echo $this->Form->create('Milli');?>
<fieldset>
<legend><?php echo __('Please enter your username and
password'); ?></legend>
<?php
echo $this->Form->input('username');
echo $this->Form->input('password');
?>
</fieldset>
<?php echo $this->Form->end(__('Login'));?>
</div>
Config/routes.php:
Router::connect('/', array('controller' => 'milli', 'action'
=> 'index'));
Router::connect('/:action', array('controller' => 'milli'));
--
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