I said that wrong, it doesn't need to be configured in the
UsersController, rather the login and logout methods should be defined
in the UsersController. You could and probably should configure the
properties of the Auth component in your AppController. Then you can
change whatever is specific about the Auth config in each different
controller that needs different options, for instance you may want to
deny certain actions in one controller but not in another. I hope
that's clearer.

On Aug 16, 9:22 pm, andrewperk <[email protected]> wrote:
> Hi, by default the Auth component needs to be configured in your
> UsersController. Your users controller only needs to have 2 actions.
>
> function login() {
>
> }
>
> You can leave the login action blank as the Auth component handles the
> rest. You just need a view for the login action.
>
> function logout() {
>    $this->redirect($this->Auth->logout());
>
> }
>
> Just create a link to the logout action to log them out.
>
> Then you only have to create a login view for your users controller
> login action. On the login view create a form with an input for the
> username and password and a submit button, and that's pretty much it.
>
> I have 3 videos on working with the Auth component on youtube here:
>
> http://www.youtube.com/watch?v=FjXAnizmR94
>
> On Aug 15, 4:09 am, LCR <[email protected]> wrote:
>
> > 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