Created
June 18, 2012 02:25
-
-
Save waltergalvao/2946467 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UsersController extends AppController { | |
public function beforeFilter() { | |
parent::beforeFilter(); | |
$this->Auth->allowedActions = array('login','logout','home','index'); | |
} | |
public function login() { | |
if ($this->request->is('post')) { | |
if ($this->Auth->login()) { | |
$this->redirect($this->Auth->redirect()); | |
} else { | |
$this->Session->setFlash(__('Login ou Senha inválidos. Tente novamente!')); | |
} | |
} | |
} | |
public function logout() { | |
$this->redirect($this->Auth->logout()); | |
} | |
public function registrar() { | |
$isPost = $this->request->is('post'); | |
if ($isPost && !empty($this->request->data)) { | |
if ($this->User->save($this->request->data)) { | |
$this->Session->setFlash('Cadastrado com sucesso','msg-good'); | |
} | |
} | |
} | |
/*public function login() { | |
if ($this->Auth->login()) { | |
$this->redirect($this->Auth->redirect()); | |
} else { | |
$this->Session->setFlash('Dados incorretos','msg-evil'); | |
} | |
} | |
public function logout() { | |
$this->redirect($this->Auth->logout()); | |
}*/ | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment