2011/7/28 castarco <[email protected]>

> Hello. I'm having strange problems with the login feature... but in a
> strange way, while it runs on my local installation, it doesn't work
> in the production server...
>
> What I expect of the code: the users fill the login form, click login
> and then is called the login action of users controller. If the users
> are logged before, then will be redirected to their dashboard, or...
> in the special case that the users are not validated (the validation
> is via email) then will logout automatically (once time, during the
> register process). If the login data is not correct, then the variable
> $cleanLogin will set to false, and the view of users login will show
> an error message.
>
> My code works perfectly in my local installation. But in the
> production server I have a "little problem", when i try to login, my
> app redirects me another time to the login page (and I'm not logged
> in), but without any error message (then, I suppose the login is well
> done, but in some point I'm automatically logged out). The production
> database is a clone of the local database.
>
> The code of the users login function:
> http://pastebin.com/DuXfez8B
>
> Anyone can imagine where is the problem? Thanks in advance!
>
>
It's very strange. I've simplified the code, now I'm using the
Auth->userScope variable to avoid using my own specific validation in login.
In any case, even with the simplification, the problem persists in the
production server, but not in my local installation.

I've logged what occurs and it's very strange! I'll tell us:

This is a part of the login function:

$userinfo = $this->Auth->user ();
 if ($userinfo) {
 $this->log('YA ESTABA LOGUEADO', LOG_DEBUG);
 $this->redirect($this->Auth->redirect());
} elseif (isset($this->data)) {
 $this->log('SET DATA!!!...', LOG_DEBUG);
if ($this->Auth->login($this->data) == 0) {
 $this->log('ME LOGUEE MAL...', LOG_DEBUG);
 $this->set ('cleanLogin', false);
} else {
 $this->log('ALGO RARO PASO!', LOG_DEBUG);
}
 } else {
print_r ($this->params);
 print_r ($this->data);
 $this->log('EN LOGIN (SIN + DATOS)', LOG_DEBUG);
$this->set ('cleanLogin', true);
 }

the strange thing: when the login is whith incorrect data, then enters in
the 'elseif' statement, but when the data is correct... enters in the 'else'
statement! Cake thinks that the $this->data variable is not defined!!!
Anyone knows why?

Thanks in advance.

-- 
- Per la llibertat del coneixement -
- Per la llibertat de la ment...       -

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to