Alexander -
encrypt takes two arguments.
ENCRPYT(str, salt)
If salt is not supplied then a random value is used. Try the following
a couple times and you'll see each time the value is difference.
select encrypt('test');
The manual states that the "salt" argument should be a two character
string. The following works the way you're expecting.
select encrypt('test', 'aa');
so change:
$authAdapter->setCredentialTreatment('ENCRYPT(?)');
to
$authAdapter->setCredentialTreatment('ENCRYPT(?, "aa")');
Thanks,
Dale
Alexander Jaeger wrote:
Hello list,
i am trying to get Zend_Auth with the Mysql ENCRYPT Function working.
Mysql-server-version: 5.0.32-Debian_7etch (stable)
This is a snippet of my code (which works perfectly with plain
passwords) :
$authAdapter = new Zend_Auth_Adapter_DbTable($db);
$authAdapter->setTableName('user');
$authAdapter->setIdentityColumn('username');
$authAdapter->setCredentialColumn('password');
$authAdapter->setCredentialTreatment('ENCRYPT(?)');
I start logging mysql queries, this is the query:
SELECT
`user`. * ,
`password` ,
`password` = encrypt( 'test' ) AS zend_auth_credential_match
FROM
`user`
WHERE
(
`username` = 'lx'
)
And the result:
id username password firstname lastname password
zend_auth_credential_match
1 lx 5Mf21xd14k08g Alexander Jäger 5Mf21xd14k08g 0
As you can see the passwords match, but there is no 'true' value for
zend_auth_credential_match.
This is the point i am confused about, is this a zend or mysql error?
I guess there is something wrong with mysql because the query and
result should be totally right!
Please, help me! ;)
Grettings,
Alex
--
------------------------------------------------------------------------
Dale McNeill |
Alchemy Systems | phone: (512) 532-8050
http://www.alchemysystems.com | email: [EMAIL PROTECTED]
------------------------------------------------------------------------