I know that AppController::beforeFiler() is a better place to put the
Auth Component configuration to share the same configuration between
all controllers and have all protected by Auth.

On Sep 23, 2:52 pm, "Golam Kibria" <[EMAIL PROTECTED]> wrote:
> hello i have tried authcomponent but i dont know why it is not working for me.
>
> i have two controller Doctors and Patients. Login methods are in
> Doctors controller.
>
> After hit the login form, the login form reappears with no flash/auth message.
>
> Doctors Controller code
>
>  var $name = 'Doctors';
>  var $components = array('Auth');
>
>     function beforeFilter(){
>         $this->Auth->userModel = 'Doctor';
>         $this->Auth->fields = array('username'=>'email',
> 'password'=>'password');
>         $this->Auth->loginAction = array('controller' => 'Doctors',
> 'action' => 'login');
>         $this->Auth->loginRedirect = array('controller' => 'Patients',
> 'action' => 'index');
>         $this->Auth->allow('login');
>         $this->Auth->authorize = 'controller';
>         $this->Auth->userScope = array('Doctor.status'=>1);
>     }
>
>     function isAuthorized() {
>          return true;
>     }
>     function login(){
>
>     }
>
>     function logout(){
>         $this->Session->setFlash('You Have been Logged Out.');
>         $this->redirect($this->Auth->logout());
>
>     }
>
> Patients Controller code
>
>  var $name = 'Patients';
>  var $components = array('Auth');
>
>    function beforeFilter(){
>         $this->Auth->userModel = 'Doctor';
>         $this->Auth->fields = array('username'=>'email',
> 'password'=>'password');
>         $this->Auth->loginAction = array('controller' => 'Doctors',
> 'action' => 'login');
>         $this->Auth->loginRedirect = array('controller' => 'Patients',
> 'action' => 'index');
>         $this->Auth->allow('login');
>         $this->Auth->authorize = 'controller';
>         $this->Auth->userScope = array('Doctor.status'=>1);
>     }
>
>     function isAuthorized() {
>          return true;
>     }
>
> anyone please help me
>
> thanks
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to