Tuesday, March 31, 2009

Re: login problem

Sorry for the noise. It was indeed this line:

$this->Auth->authorize = 'actions';

I thought that because there is no ACO for PagesController there
wouldn't be a problem. In any case, this isn't what I want to do,
after all.

Back to the drawing board ...

On Tue, Mar 31, 2009 at 10:14 PM, brian <bally.zijn@gmail.com> wrote:
> The problem is simply that I can't log in. I've done this before but
> I'm trying to build an ACL-controlled site and following along with
> the manual's example app. WHen I try loggin in I get "You are not
> authorized to access that location." I suspect the problem might be
> with the redirect, and not my credentials, as I'm not seeing Auth's
> loginError.
>
> AppController:
>
> function beforeFilter()
> {
>        $this->Auth->fields = array('username' => 'email', 'password' => 'password');
>        $this->Auth->userScope = array( 'User.enabled' => 1);
>        $this->Auth->loginError = 'No matching user found.';
>        $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
>        $this->Auth->loginRedirect = array('controller' => 'pages', 'action'
> => 'display', 'home');
>        $this->Auth->logoutRedirect = array('controller' => 'users', 'action'
> => 'login');
>        $this->Auth->authorize = 'actions';
>        $this->Auth->actionPath = 'ROOT/';
> }
>
> UsersController:
>
> function beforeFilter()
> {
>        parent::beforeFilter();
>        if ($this->action == 'login') $this->layout = 'login';
>        $this->Auth->allowedActions = array('reset_password');
> }
>
> public function login() {}
>
> public function logout()
> {
>        $this->Session->setFlash('Good-Bye');
>        $this->redirect($this->Auth->logout());
> }
>
> As you can see, it's not much different than the manual. The
> beforeFilter layout switch is there because none of the pages for this
> site should be public (it's an extranet).
>
> The password is good, and my user is enabled.
>
> I have nothing in my acos table yet, so I think that shouldn't be the
> cause of this. AFAICT, if PagesController::display() is not in acos,
> there shouldn't be any problem. Correct me if I'm wrong, please.
>
> Can anyone see something missing? Or think of something else I can check?
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: