Perhaps one way to do it. Take a look at:

http://api.cakephp.org/class/auth-component#method-AuthComponentisAuthorized

Property: authorize
Method:   isAuthorized

Regards,

Alfredo

On Mon, Apr 6, 2009 at 3:36 PM, Mauricio Tellez
<mauricio.tel...@gmail.com> wrote:
> Hi, I'm building a cake app that need to authentify agains a legacy
> database. That database has a user table with users login and password data,
> but the password is encrypted with MySQL's aes_encrypt. Looking at cake Auth
> mechanism there is no way I can auth against this table, so I'm wondering if
> I can hook some method to the auth process like this:
>
> function check_credentials($login, $passwd) {
>     $data = $this->User->query(sprintf("SELECT * FROM users WHERE
> username='%s' AND passwd=aes_decrypt('%s') ", $login, $passwd);
>     if(sizeof($data) > 0) {
>       return true;  // The username and passwd are valid
>     } else {
>       return false;  // The username or passwd are invalid
>     }
> }
>
> I know this is not the best way to do it, but maybe the easiest way. Can I
> something like this? or wath other options do I have? Thanks in advance!
>
> --
> Mauricio Tellez
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to