thanks martin. but when i changed controller name from Patients to patients and Doctors to doctors, it works.
do i always need to name controller in lowercase? thanks. On Sep 25, 1:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > One thing I notice in your code is that you allow "login". Skip that. > Auth will allow access to the login-action by itself and this will > create a conflict. > > On Sep 23, 9: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 -~----------~----~----~----~------~----~------~--~---