$this->Auth->allow('display','index','register'); you don't have a 'display' funtion in your controller..don't know much maybe this is it.
On 15 Sep, 06:51, "Golam Kibria" <[EMAIL PROTECTED]> wrote: > hello i have triedauthcomponent and is not working for me. > > here is my code > > <?php > class UsersController extends AppController { > > var $name = 'Users'; > var $helpers = array('Html', 'Form', 'Time', 'Javascript'); > var $components = array('Auth'); > > var $ext = '.php'; > > function beforeFilter(){ > //Security::setHash('md5'); > $this->Auth->fields = array('username'=>'username', > 'password'=>'password'); > $this->Auth->loginAction = array('controller' => 'users', > 'action' > => 'login'); > $this->Auth->loginRedirect = array('controller' => 'users', > 'action' => 'index'); > $this->Auth->allow('display','index','register'); > $this->Auth->authorize = 'controller'; > $this->Auth->userScope = array('User.status'=>1); > } > function isAuthorized() { > return true; > } > > //var $uses = array('Group'); > //var $layout='tadmin'; > > function index() { > > $this->User->recursive = 0; > $this->set('users', $this->paginate()); > > //$this->Group-> > > //print_r($this->paginate()); > } > > function view($id = null) { > if (!$id) { > $this->Session->setFlash(__('Invalid User.', true)); > $this->redirect(array('action'=>'index')); > } > $this->set('user', $this->User->read(null, $id)); > } > > function add() { > if (!empty($this->data)) { > > $this->data['User']['password']=$this->Auth->password($this->data['User']['password']); > $this->User->create(); > if ($this->User->save($this->data)) { > $this->Session->setFlash(__('The User has > been saved', true)); > $this->redirect(array('action'=>'index')); > } else { > $this->Session->setFlash(__('The User could > not be saved. Please, > try again.', true)); > } > } > > $groups=$this->User->Group->find('list'); > //$groups=$this->User->Group->generateList(null, 'name ASC', > null, > '{n}.Group.id', '{n}.Group.name'); > $this->set('groups',$groups); > //print_r($groups); > } > > function edit($id = null) { > if (!$id && empty($this->data)) { > $this->Session->setFlash(__('Invalid User', true)); > $this->redirect(array('action'=>'index')); > } > if (!empty($this->data)) { > if ($this->User->save($this->data)) { > $this->Session->setFlash(__('The User has > been saved', true)); > $this->redirect(array('action'=>'index')); > } else { > $this->Session->setFlash(__('The User could > not be saved. Please, > try again.', true)); > } > } > if (empty($this->data)) { > $this->data = $this->User->read(null, $id); > } > $groups=$this->User->Group->find('list'); > $this->set('groups',$groups); > } > > function delete($id = null) { > if (!$id) { > $this->Session->setFlash(__('Invalid id for User', > true)); > $this->redirect(array('action'=>'index')); > } > if ($this->User->del($id)) { > $this->Session->setFlash(__('User deleted', true)); > $this->redirect(array('action'=>'index')); > } > } > > function register(){ > if(!empty($this->data)){ > $this->data['User']['status']=1; > $this->data['User']['group_id']=3; > $this->data['User']['password']= > $this->Auth->password($this->data['User']['password']); > $this->User->create(); > if($this->User->save($this->data)){ > $this->Session->setFlash(__('User > Registration Complete',true)); > $this->redirect(array('action'=>'index')); > }else{ > $this->Session->setFlash(__('Problem found. > Please, try again.', true)); > } > } > } > > function login(){ > > } > > function logout(){ > $this->redirect($this->Auth->logout()); > > } > > } > > ?> > > i tried md5 hashing insted of sha1, but it not working. anybody please help > me. > > -- > Best Regards > =========== > Golam Kibria Shapan > Dhaka Medical College > Dhaka, Bangladesh. > ---------------------- > MedicBD, Medical Info Services:http://www.medicbd.com > WebHostBD, Web & Intranet Solution:http://www.webhostbd.com > BiBorton, Bangla Magazine:http://bn.biborton.com > My Facebook Apps:http://apps.facebook.com/world-today/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---