Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. CakePHP autentication with auth table other than User problem
  2. class AppController extends Controller {
  3. var $components = array('Auth', 'Session', 'Cookie', 'P28n');
  4.  
  5.     function beforeFilter() {
  6.  
  7.         $this->Auth->authenticate = ClassRegistry::init('Reviewer');
  8.  
  9.         Security::setHash('sha1'); // or sha1 or sha256
  10.         $this->Auth->userModel = 'Reviewers';
  11.     $this->Auth->fields = array('username' => 'username', 'password'=>'password');
  12.     $this->Auth->loginRedirect = array('controller' => 'reviewers', 'action' => 'view');
  13.  
  14.     }
  15.        
  16. $this->data['User']['password'] = Security::hash($this->data['User']['password']);