Hatsuney Hatsuney - 1 year ago 92
PHP Question

How can I use different model for Auth component in CakePHP 2.0.4?

It looks like trivial thing, but I really can't find where I can change it.
I want to use my "Player" model instead of User, but every time I go on /players/login it redirects me to "Missing Controller" page and link changes to /users/login.

I tried:

public $components = array(
'Auth' => array(
'authenticate' => array('all' => array('userModel' => 'Player'))


function beforeFilter() {
$this->Auth->authenticate = array('all' => array('userModel' => 'Player'));


'loginAction' => array('controller' => 'players', 'action' => 'login')

in $components array helped, I think :D

Answer Source

I guess the problem is that you aren't providing an authenticating system. You're providing some settings to be used in all the authenticating system that will be chosen, but you haven't chosen one yet (you have to provide at least one like Form, Basic, Digest, ecc..).

$this->Auth->authenticate = array(
    'all' => array('userModel' => 'Member'),

(or the same in the $components array)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download