I have a very simple login authentication system, and depending on the
outcome I either redirect to an action in a different controller or
post an error message in the session and redirect back to the login
page: -
$username = $this->data['User']['username'];
$password = md5($this->data['User']['password']);
$user = $this->User->findByUsername($username);
if((!empty($user)) && ($user['User']['password'] == $password)) {
$this->Session->write("user", $username);
$this->Session->write("userid", $user['User']['id']);
$redirect = "/cms/page/";
} else {
$this->Session->write("loginerror", "Username and/or password
incorrect");
$redirect = "/cms/user/login/";
}
$this->redirect($redirect);
exit();
Now I can't see what i'm doing wrong here, but sometimes it works and
sometiomes it doesn't. It is very frustrating as the rest of my
system is pretty much bulletproof and this tiny thing is stopping me
progressing on the last 10% of the project!!
Any help greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---