Re: Auth->userScope is getting ignored

2012-04-08 Thread Vitor Pacheco
try this:
$this->Auth->authenticate = array(
AuthComponent::ALL => array(
 'userModel' => 'User',
'fields' => array(
 'username' => 'test',
'password' => 'test',
 ),
'scope' => array(
'User.usr_active' => 1,
 )
),
'Form'
 );

http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html


2012/4/8 heohni 

> Update:
>
> even if add this for testing
>
>   $this->Auth->fields = array('username' => 'test', 'password' => 'test' );
>
> This is also ignored...
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>



-- 
*Vitor Pacheco*
*Skype: vitor.pacheco.costa
Msn: vitor-...@hotmail.com*
*GTalk: vitorpc...@gmail.com**
**Cel.: 71 8626-7909
Tel.: 71 3378-5778 /** 71 3287-3475*

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Auth->userScope is getting ignored

2012-04-08 Thread heohni
Update:

even if add this for testing

  $this->Auth->fields = array('username' => 'test', 'password' => 'test' );

This is also ignored... 

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Auth->userScope is getting ignored

2012-04-08 Thread heohni
Update:

I found no the way with debug kit how to see the statement.
And as I guessed, the userScope is not taking place:
  WHERE `User`.`username` = 'xx' AND `User`.`password` = 'xx' LIMIT 1 


I added
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->userModel = 'User';
$this->Auth->userScope = array('User.usr_active' => '1');

But still the active is not getting checked.


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Auth->userScope is getting ignored

2012-04-08 Thread heohni
Hi,

I want to allow only active users to login and I used for this: 
public function beforeFilter() {
   parent::beforeFilter();
   $this->Auth->userScope = array('User.usr_active' => '1');
}

public function login() {
   if ($this->Auth->login()) {
   ...


But I can still login with inactive users ( usr_active == 0 ) 

How can I make the the sql statement visible the auth function is using to 
check for the user?
I have the feeling that the active is just ignored.

How can I debug this in cake 2.1 ?

Thanks

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php