Thursday, January 29, 2009

Re: behaving the CakePHP 1.2 way

I did not try this yet, but this should help you, right?:

http://teknoid.wordpress.com/2008/10/08/demystifying-auth-features-in-cakephp-12/

p.s. I believe the whole thing is because AuthComponent is
AuthComponent and not AuthBehavior. If it came with such a thing it
would be more clear (because hashing would take place in the model
then)

On Jan 28, 8:04 pm, Delirium tremens <pedbe...@gmail.com> wrote:
> there is no afterValidate
> there is no beforeLogin
>
> What now???
>
> On 28 jan, 16:47, Delirium tremens <pedbe...@gmail.com> wrote:
>
> > I added:
>
> > function beforeSave() {
> >         $this->data['Account']['password'] = md5($this->data['Account']
> > ['password']);
> >         return true;
>
> > }
>
> > to Account model, but now login does not work. Why?
>
> > On 28 jan, 16:04, Delirium tremens <pedbe...@gmail.com> wrote:
>
> > > Hold on... I need it encrypted after validated... What now???
>
> > > On 28 jan, 15:53, Delirium tremens <pedbe...@gmail.com> wrote:
>
> > > > I understood! I added it to BeforeFilter. It works!
>
> > > > On 28 jan, 15:37, Delirium tremens <pedbe...@gmail.com> wrote:
>
> > > > > I added:
>
> > > > > $this->Auth->authenticate = $this->Account;
>
> > > > > to login.
>
> > > > > I added:
>
> > > > >     function hashPasswords( $data ) {
> > > > >         return $data;
> > > > >     }
>
> > > > > to Account model.
>
> > > > > After updating my account, $cakeDebug (my debug config is 2, so flash
> > > > > is eternal) flashed my password hashed. Am I doing anything wrong?
>
> > > > > On 27 jan, 21:34, Gonzalo Servat <gser...@gmail.com> wrote:
>
> > > > > > On Tue, Jan 27, 2009 at 8:26 PM, Delirium tremens <pedbe...@gmail.com>wrote:
>
> > > > > > > CakePHP 1.2 is encrypting passwords before validating them.
>
> > > > > > > CakePHP 1.2 is trying to make us behave in a different way.
>
> > > > > > > Are you behaving the CakePHP 1.2 way?
>
> > > > > > > What are you doing now that you are not allowed to validate passwords?
>
> > > > > > I take it you're talking about the AuthComponent? If so, yes it hashes
> > > > > > passwords automagically so you basically just store the hashed password in
> > > > > > your DB. If you don't want that, you can do something like this:
>
> > > > > > $this->Auth->authenticate = $this->User;  // or whatever ...
>
> > > > > > Inside the User model, you could have:
>
> > > > > > function hashPasswords( $data ) {
> > > > > >       return $data;
>
> > > > > > }
>
> > > > > > Instead of hashing the password, it just returns it unmodified (clear text).
>
> > > > > > - Gonzalo
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: