I'm not sure how the rest of your app is configured, but my guess is
that the last line is causing you problems:
$this->Auth->login($this->User);
I'm not sure it is necessary to do this, because now that you have
modified the database entry for the user, I believe the standard
AuthComponent login should work without you having to call it
manually.
On Aug 25, 4:53 am, Baxter <[EMAIL PROTECTED]> wrote:
> I've gone ahead and done what JS recommended, and it's all working,
> except for one little thing. After I convert the password and log the
> user in, an Auth error is displayed, even though they are logged in
> successfully. Here's what I have in my Users beforeFilter:
>
> if(!empty($this->data) && isset($this->data['User']['login'])) :
> $params = array('conditions' => array('User.username' =>
> $this->data['User']['username']));
>
> $user = $this->User->find('all',$params);
> if((sizeof($user) == 1) && ($user[0]['User']['password_migrated'] ==
> 0)) :
> $this->data['User']['id'] = $user_test[0]['User']['id'];
> $submitted = $this->data['User']['password'];
> $submitted_md5 = md5($submitted);
> $db_md5 = $user[0]['User']['password_md5'];
> if($submitted_md5 == $db_md5) :
> $this->data['User']['password'] =
> $this->Auth->password($submitted);
>
> $this->data['User']['password_migrated'] = 1;
> $this->User->save($this->data);
> $this->Auth->login($this->User);
> endif;
> endif;
> endif;
>
> Any idea what's causing the error to be displayed? Thanks in advance!
>
> On Aug 11, 12:44 pm, "Jonathan Snook" <[EMAIL PROTECTED]>
> wrote:
>
> > Modify the user table on the new server to include a new flag:
> > updated. Set it to 1 for all users already set to SHA-1. Copy all the
> > users from the old system and make sure the updated flag is set to 0.
>
> > When a user logs in, check the updated flag. If it's 1, do a SHA-1
> > encryption to compare the passwords. If it's a 0, use MD5 to compare
> > the passwords. But here's the fun part: take the user's password (the
> > unencrypted one sent via the form) and do a SHA-1 encryption on it and
> > save it to the database, modifying the updated flag at the same time.
>
> > Eventually, all your users will be moved over to SHA-1.
>
> > Good luck and godspeed.
>
> > On Mon, Aug 11, 2008 at 12:49 PM, Kyle Decot <[EMAIL PROTECTED]> wrote:
>
> > > Okay. The problem is that I have users in the new system with SHA-1
> > > and users in the old system with MD5. How would I go about merging
> > > these two together?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---