Sorry Jason in Postgresql "something" refer to a db, schema, table, column name
so a 0="0" -> column doesn't exist
but yes a select false = '0' is true.
But here what I've use as code which work in similar conditions
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'login', 'password',
'MD5(?) AND active = TRUE');
$dbAdapter->setCredential( $values['userpassword'] )
->setIdentity( $values['userlogin'] );
$result = $this->_auth->authenticate($dbAdapter);
In dele454 code it's seem you missed the place for hashed password in the
marked place for the password
so a
$authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members','Email',
'Password', '? AND IsActive != "0"');
would do the trick.
Jason Webster wrote:
> Not really...
>
> SELECT 0 = "0" // true
> SELECT FALSE = "0" // true
> SELECT FALSE = 0 // true
>
> Bruno Friedmann wrote:
>> Hi
>> Just a word : be carefull with 0/1 TRUE/FALSE and the type of your
>> column and the database used.
>>
>>
>> I suspect if you write you
>> $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members',
>>
>>> 'Email', 'Password', 'AND IsActive != "0"');
>>>
>>
>> AND IsActive != 0
>>
>> this would work ... :-)
>> As another advice to be more SQL linguistic I would inverse the " and '
>> "AND IsActive != '0'")
>>
>>
>>
>> dele454 wrote:
>>
>>> Am trying to implement a similar scenario where if the column
>>> IsActive is set
>>> to '0' the authentication should fail. A typical scenario is when a user
>>> just signed up and still needs to active acct before allowed to gain
>>> access.
>>>
>>> I followed the instruction in the Ref Guide but it isnt working. If
>>> the user
>>> supplies email+password before acct is activated - login is granted.
>>>
>>> The only code i didnt implement from the advanced useage example is the
>>> MD5(?) because i have something similar implemented already. Except
>>> if it
>>> does something else - i cant loggin with any credentials if i include it
>>> though
>>>
>>>
>>> $db= Zend_Registry::get('db');
>>> $authAdapter = new Zend_Auth_Adapter_DbTable($db,
>>> 'Members',
>>> 'Email', 'Password', 'AND IsActive != "0"');
>>>
>>> $config = Zend_Registry::get('config');
>>> $password = $logins['password'];
>>> $salt = "$^&##&@";
>>> $password =
>>> md5($salt.$logins['password']);
>>>
>>> $authAdapter->setIdentity($logins['email']);
>>> $authAdapter->setCredential($password);
>>> return $authAdapter;
>>>
>>> Please help is needed thanks :)
>>>
>>> -----
>>> dee
>>>
>>
>>
>>
>
--
Bruno Friedmann
Ioda-Net Sàrl
2830 Vellerat - Switzerland
Tél : ++41 32 435 7171
Fax : ++41 32 435 7172
gsm : ++41 78 802 6760
www.ioda-net.ch
Centre de Formation et de Coaching En Ligne
www.cfcel.com