Hi All,
The source code for http://www.noswad.me.uk/demos/chat/ now includes a
component used for authentification (which simply makes use of the
Pear:Auth package), it may be useful in considering how to use simple
authentification.
The chat doesn't restrict anonymous users, but could easily do so if
there is no logged in user. To restrict access for a controller if
there is no user logged in one would create a function in
app_controller such as:
function _checkLoggedIn()
{
if ($this->Authorise->uid)
{
return true:
}
else
{
$this->Session->setFlash ("You aren't logged in'");
$this->controller->redirect ("/");
die; // Prevent any further processing whatsoever.
}
}
and call it in the beforeFilter of your controller ( if defined in
AppController it would be called for all controllers - careful to still
give the user a chance to access the login page if you do this ;) )
Hydra12,
I'm curious if there are any benefits we can glean from each other's
code with regards to the Ajax chat example.
Comments welcome,
AD7six
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---