Why are you reading the session? That assumes the user is already logged in.
function login() {
if(!empty($this->data)) {
if($this->Auth->login($this->data){
...... code here
}
}
}
Might want to turn autoRedirect off?
If you are using a beforeFilter in your users controller, be sure to add
"parent::beforeFilter();" at the top of the function so that it doesn't
overwrite the app_controller's version.
On 8 March 2011 21:36, DerekGardiner <[email protected]> wrote:
> 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
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>
--
Kind Regards
Stephen
http://www.ninjacodermonkey.co.uk
--
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