Tuesday, March 8, 2011

$this->Auth->userScope

In an effort to make sure that only active users can log into the
application I've added the following in my app_controller

function beforeFilter() {
$this->Auth->userScope = array('User.active' => 1);

}

and the following in my login function under my users_controller

function login() {

if ($this->Session->read('Auth.User')) {
$active = $this->Auth->user('active');
if ($active) {
//(do stuff)
}
else {
//(do other stuff)
}
}
}
but when testing I am still able to login with inactive users.
Furthermore if I try to debug or echo in the app_controller-
>beforeFilter function it doesn't even print anything out which makes
me thing the function isn't being called in the first place.

I've read the cake documentation on the topic - what am i doing wrong
here?

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate