Thanks for your response OldWest. I've just changed how this is done,
but it's still not working.
I would like the login page to appear like a regular page, so I want
users to be able to enter '/pages/membership' and be taken to the
page, which looks like all the others.
I've routed it like this:
(in routes.php)
Router::connect('/pages/membership', array('controller' => 'users',
'action' => 'login'));
Router::connect('/pages/*', array('controller' => 'pages', 'action'
=> 'view'));
As a double-check, in pages_controller.php I have:
function view($pagetitle=null) {
... little bit of error checking...
if($pagetitle=='membership') $this->redirect('users/login');
... rest of function ...
In users_controller.php, I have:
function login() {
$this->set('title_for_layout', 'Please log in');
$this->set('page', $this->Page->findByTitle('membership'));
debug( $this->data );
}
and the view is like this:
<div class="title">
<h1><?php echo $page['Page']['heading'];?></h1>
</div>
<div class="main">
<div class="columnone">
<?php echo $page['Page']['column1'];?>
</div>
<div class="columntwo">
<?php echo $page['Page']['column2'];?>
</div>
<div class="columnthree">
<?php echo $this->Session->flash('auth');
echo $this->Session->flash();?>
<h2>PRIVATE LOGIN</h2>
<?php
echo $this->Form->create('user', array('action' => 'login',
'class' => 'columnform'));
echo $this->Form->input('username', array('label' => 'name'));
echo $this->Form->input('password');
echo $this->Form->end('Login');
?>
</div>
<div class="clear"></div>
</div><!-- Close main -->
In app_controller, I have a beforeFilter function which contains:
$this->Auth->loginAction = array('controller' => 'users',
'action'
=> 'login', 'admin' => 0);
$this->Auth->loginRedirect = array('controller' => 'pages',
'action' => 'index', 'admin' => 1);
So when I log in, I should be sent to the page admin/pages/index.
However, when I try to log in, I just get returned to the login page,
with no flash messages or anything.
I've tried clearing the cache, and I haven't found anything online.
I'd really appreciate any help.
Thanks!
--
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