1

I want to use AuthComponent in CakePHP with a model (and its corresponding table) named Admin ('admins' table in the database). I've used $this->Auth->userModel = 'Admin'; as the documenation says in the BeforeFilter() function of the app_controller, to indicate that I'm not using the deafult model User.

However, either I'm doing it in the wrong place or there's something else that needs to be done, because I can't make the authentication to work (the login function in my admins_controller.php). The rest of functions work well (for example the add function).

If I use the name User for my model with a users table, it works perfectly. How do I fix this problem?

1
  • It can also be done with an array option of 'userModel' => 'Admin' when you add Auth component to your controller Commented Sep 7, 2012 at 18:00

1 Answer 1

2

Make sure you call parent::beforeFilter() in your AdminController::beforeFilter().

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.