0

Hi I have followed through the cake users guide and followed the auth tutorial. I have had trouble with the login method. It seems the method is only getting called when it does not log in. Whenever it is able to log in successfully all of the session variables that I set in the User controller's login method do not display in the redirected view. I can't seem to narrow this down.

1
  • oh I see that I need to add $this->Auth->autoRedirect = false; to my appcontroller. Commented May 11, 2011 at 7:38

1 Answer 1

1

I think this is something that should be mentioned in the Cake tutorial (or maybe I somehow missed it,) but the function of the User -> login() method gets skipped over by the auth component and never executed. It seems that in order to execute the login code you have to add this to the before filter of you app controller:

$this->Auth->autoRedirect = false;

then you can manually log in through the login() method like so:

$this->Session->read('Auth.User')

Hope this helps someone :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.