Re: Automatic Login after Signup using Auth Component

2008-09-24 Thread mario
$this->Auth->login unfortunately doesn't use "email" as one of it's fields in logging in. it instead uses "username" and "password" as its default fields. You can see it at the implementation of the login function of Auth. http://api.cakephp.org/1.2/auth_8php-source.html#l00568 it uses $this->i

Re: Automatic Login after Signup using Auth Component

2008-09-24 Thread Edi
I am also having this problem. I can't make it login. Tried several versions, with both passwords (hashed, no hashed), but nothing. Currently i have this: $this->Auth->login(array('User'=>array('email'=>$this->data['User'] ['email'], 'password'=>$this->data['User']['password2']))) but it is not

Re: Automatic Login after Signup using Auth Component

2008-09-24 Thread mario
Hello Fran, I got it now working. Thanks for the big help! Actually, $this->Auth->login($this->data); // login user is already correct. I just missed to call the line to redirect the user to the designated page. Now it looks like this: if ($this->User->save($this->data)) { $login = $t

Re: Automatic Login after Signup using Auth Component

2008-09-24 Thread Fran Iglesias
El 24/09/2008, a las 9:31, mario escribió: > So in this case, > $this->Auth->login($this->data); // login user I think you have the plain version of the password in password2 field. You could do some like: if ($this->User->save($this->data)) { $this->data['User']['password'] = $this

Re: Automatic Login after Signup using Auth Component

2008-09-24 Thread mario
Yup. I see the point. So in this case, $this->Auth->login($this->data); // login user I'm trying to pass the data from my form to be used for login. As what I know, cakephp automatically hashes the password field of the model 'user'. So using $this->data in $this->Auth->login() might have some p

Re: Automatic Login after Signup using Auth Component

2008-09-24 Thread Fran Iglesias
El 24/09/2008, a las 9:02, mario escribió: > This time, it failed to login the user. It seems like there is some > problem in terms of hashing my password. Not sure, but you may try to login the User, with the non-hashed password. -- Fran Iglesias [EMAIL PROTECTED] --~--~-~--~--

Re: Automatic Login after Signup using Auth Component

2008-09-24 Thread mario
That would be one option. Here is my signup code: function signup() { if (!empty($this->data)) { if(isset($this->data['User']['password2'])) { $password2hashed = $this->Auth->password($this- >

Re: Automatic Login after Signup using Auth Component

2008-09-23 Thread Fran Iglesias
El 24/09/2008, a las 7:28, mario escribió: > Do anyone of you have an idea on how to automatically login > after signing-up using Auth Component? This seems a task for $this->Auth->login() http://api.cakephp.org/1.2/class_auth_component.html#5c2562e36d1fb6f8b93a15fb23604abc -- Fran Iglesias

Re: Automatic Login after Signup using Auth Component

2008-09-23 Thread mario
Thanks Amit. I have tried your suggestion. I used: $this->Auth->Session->write($this->Auth->sessionKey . '.id', $this- >User->getLastInsertID()); but it just became worse. $this->Auth->user('id') doesn't return anything if I do that. On Sep 24, 1:39 pm, "Amit Badkas" <[EMAIL PROTECTED]> wrote:

Re: Automatic Login after Signup using Auth Component

2008-09-23 Thread Amit Badkas
2008/9/24 mario <[EMAIL PROTECTED]> > > Hello everyone, > > Do anyone of you have an idea on how to automatically login > after signing-up using Auth Component? > > I have tried like: > > $this->User->create(); > if ($this->User->save($this->data)) > { >$this->Auth->Session->write($this->A

Automatic Login after Signup using Auth Component

2008-09-23 Thread mario
Hello everyone, Do anyone of you have an idea on how to automatically login after signing-up using Auth Component? I have tried like: $this->User->create(); if ($this->User->save($this->data)) { $this->Auth->Session->write($this->Auth->sessionKey, $this->User- >getLastInsertID());