Hi all,
This is my 2nd cakePHP project and I have a request from my client to
have authorization features for their site, so I figured this would be
a good opportunity to look at the AuthComponent. I have it set up
along with my MCV stuff. It looks like by default it expects the
model it's associated with to have username and password properties
which is what it uses to check and authenticate with. My client only
wants a 'passcode' to authorize users rather than a username/password
combo. How can I set this up using the AuthComponent? I've tried
adding a beforeFilter method to my Controller:
function beforeFilter() {
$this->Auth->fields = array('passcode' => 'passcode');
}
But am not getting anywhere with it. In my Controller's login
function I have:
public function login(){
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->Session->setFlash('login successful.');
return $this->redirect($this->Auth->redirect());
} else {
// $this->Session->setFlash('FAIL');
$this->Session->setFlash(__('Passcode not found.'), 'default',
array(), 'auth');
debug($this->data);
$this->set('login_form', true);
}
} else {
$this->set('login_form', true);
}
}
When POST data is submitted with the passcode set to a user's passcode
in the db, I'm still getting the 'passcode not found' Auth Flash, so I
clearly don't have AuthComponent just checking the passcode, yet, but
am not sure what I'm missing to make it just check the passcode. Just
not sure of the internal workings of the AuthComponent's login()
function and how it determines success or failure. Any thoughts?
Thanks for your time.
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php