Advertisement
Guest User

Untitled

a guest
Feb 4th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. // AppController.php
  2. public $components = array(
  3. 'Session',
  4. 'Auth' => array(
  5. 'authenticate' => array(
  6. 'Blowfish' => array(
  7. 'scope' => array('User.is_active' => true)
  8. )
  9. ),
  10. 'loginRedirect' => array('controller' => 'pages', 'action' => 'home'),
  11. 'logoutRedirect' => array('controller' => 'pages', 'action' => 'home')
  12. )
  13. );
  14.  
  15. // UsersController.php
  16. public function login() {
  17. if($this->request->is('post')) {
  18. if($this->Auth->login()) {
  19. $this->redirect($this->Auth->redirect());
  20. } else {
  21. $this->Session->setFlash('Invalid username or password, try again.');
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement