I've followed your guide to auth:
http://book.cakephp.org/view/1250/Authentication
This is my app_controller.php:
class AppController extends Controller {
var $components = array('DebugKit.Toolbar', 'Session', 'Auth');
var $helpers = array('Html','Javascript', 'Session', 'Ajax',
'Facebook.Facebook');
function beforeFilter()
{
// importa modello Season
$this->Season = ClassRegistry::init('Season');
// ricava la variabile di sessione
$id = $this->Session->read('editable_season_id');
// verifica se tale id è esistente
$exist = $this->Season->exist($id);
// se non esiste o è un valore non valido o è nullo
if((is_null($id)) || (!is_numeric($id) || (!$exist)))
{
// cerca l'id della stagione più recente
$id = $this->Season->getLastSeasonId();
// se esiste assegnalo ad una var di sessione
if($id)
{
$this->Session->write("editable_season_id", $id);
$title = $this->Season->getSeasonName($id);
$this->Session->write("editable_season_title",
$title);
$this->redirect($this->referer());
} else { // altrimenti lancia errore
$seasons = $this->Season->getSeasons();
$this->cakeError('defaultSesonNotFound',
array('seasons' => $seasons));
}
}
}
}
It works correctly. Now if inside a controller there's an action and i
want to make it public i override beforeFilter method:
function beforeFilter()
{
parent::beforeFilter();
$this->Auth->allow(array('showTables'));
}
When i call http://...../showTables/season_id:1 for the first time I
will be redirect to the login page. Now if I rewrite
http://...../showTables/season_id:1
for the second time the action will be showed (without insert user and
password).
Why this strange behavior?
--
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