Monday, August 3, 2009

Re: login: Auth not setting Session flash

<?php $session->flash('auth'); ?>

http://book.cakephp.org/view/564/Displaying-Auth-Error-Messages


On Aug 2, 9:16 pm, brian <bally.z...@gmail.com> wrote:
> Failed logins are not getting Auth's msg displayed. I've done this
> before but I'm about out of ideas why this isn'tworking. Can someone
> take a look at this and tell me what I'm missing?
>
> AppController:
>
> function beforeFilter()
> {
>         $this->Auth->authorize = 'controller';
>         $this->Auth->fields = array('username' => 'email', 'password' => 'password');
>         $this->Auth->loginError = 'No matching user found.';
>         $this->Auth->autoRedirect = true;
>         $this->Auth->loginAction = array(
>                 'controller' => 'users',
>                 'action' => 'login'
>         );
>         $this->Auth->loginRedirect = array(
>                 'controller' => 'public_static',
>                 'action' => 'display',
>                 'home'
>         );
>         $this->Auth->logoutRedirect = array(
>                 'controller' => 'public_static',
>                 'action' => 'display',
>                 'home'
>         );
>
>         if (!$this->Session->read('User'))
>         {
>                 $this->Auth->authError = 'Please log in';
>         }
>
>         $admin = Configure::read('Routing.admin');
>
>         if (isset($this->params[$admin]) && $this->params[$admin])
>         {
>                 $this->layout = 'admin';
>         }
>
>         if ($this->RequestHandler->isAjax())
>         {
>                 Configure::write('debug', 0);
>                 $this->layout = 'ajax';
>         }
>
> }
>
> UsersController:
>
> public function login() {}
>
> layouts/plain.ctp:
>
>         <div id="content" class="Wide">
>                 <?= $session->flash() ?>
>                 <?= $content_for_layout ?>
>         </div>
>
> Flash messages are working properly elsewhere. It's only these login
> ones that are not displaying.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: