1
votes

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

1 Answers

2
votes

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