Hi there,

Hoping someone can help me keep the rest of my hair... I've spent the
last day looking over so many Auth tutorials and haven't got anywhere.
For some reason I haven't been able to get my head around it so far,
so I've come on here in the hope of getting a specific example that
helps me with my specific case (which I don't think is uncommon). For
someone with more experience with the framework, this should be a
piece of cake! wink.gif

I'm building a site in CakePHP (v1.3.10) that needs an admin back-end
accessed via "/cms". The back end must be accessed by a single user
log-in. Once they are logged in, they can use all the features of the
CMS, and if they try to access any of the CMS while not logged in,
they should get redirected to the CMS login page. It's that simple!

In routes.php I have the following:

Router::connect('/cms', array('controller' => 'homepages', 'action' =>
'index', 'admin' => true));

My homepages_controller is responsible for showing the public-facing
home page, and currently the index() action also takes care of
checking to see if it should display the CMS login page:

function index() {
 if ( isset($this->params['admin']) && $this->params['admin']) {
  $this->layout = false; # We'll just use the view for now
  $this->viewPath = 'cms';
  $this->render('index');
 }

 $this->Homepage->recursive = 0;
 $this->set('homepage', $this->Homepage->find('first'));
 $this->set('title_for_layout', 'my title');
}

There's also a cms_index() action in the homepages_controller which is
currently commented out, and ideally I think I'd like that to
automatically take care of showing the CMS login page without me
having to check the 'admin' parameter in the front-end index() action.

In my core.php I have the following:

Configure::write('Routing.prefixes', array('cms'));


I also know that in my app_controller file I need to put:

var $components = array('Auth')


I have set up my users table with id, username and password.

It's where to go from here, and how to configure the Auth component,
that has me stumped.

Would any kind souls like to share with me what the next step might
be? (Incidentally, I can't use the .htaccess method to achieve this -
I need to use the Auth component if at all possible.)

Many thanks in advance.

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