Saturday, January 28, 2012

Re: authentication with 2 tables

You need to enhance core authentication adapter - add support for
arrays in userModel configuration option, for usage in controller like
this:

public $components = array(
'Auth' => array(
'authenticate' => array(
'App' => array('userModel' => array('Tutor', 'Student'))
)
)
);

So, implement your own logic in following 2 methods and that's it
(piece of cake).

<?php
# app/Controller/Component/Auth/AppAuthenticate.php

App::uses('FormAuthenticate', 'Controller/Component/Auth');

final class AppAuthenticate extends FormAuthenticate {

public function authenticate(CakeRequest $request, CakeResponse
$response) {
}

protected function _findUser($username, $password) {
}
}

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: