Hi guys.
I'm using cakephp 2.x and can't seem to make Auth->login() work.
app/Controller/AppController.php
class AppController extends Controller {
// sitema de autentificacao simples
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
public $components = array(
'Session',
'Auth' => array(
'loginAction' => array('controller'=>'eleitores',
'action'=>'login'),
'loginRedirect' => array('controller'=>'linhas',
'action'=>'index'),
'logoutRedirect' => array('controller'=>'pages',
'action'=>'display', 'index'),
'authorize' => array('Controller'),
'authenticate' => array(
'Form' => array(
'userModel' => 'Eleitore',
'scope' => array('Eleitore.id' => 1)
)
),
'authError' => 'Você não possui autorização para acessar esta
página!'
)
);
public function beforeFilter() {
$this->Auth->allow();
}
...
app/Controller/EleitoresController.php
Auth->userModel = 'GroupUser';
if ($this->request->is('post')) {
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirect());
}
$this->Session->setFlash(__('Invalid username or password,
try again'));
}
}
app/View/Eleitores/login.ctp
Session->flash('auth'); ?>
Form->create('Eleitore'); ?>
Form->input('username');
echo $this->Form->input('password');
?>
Form->end(__('Login')); ?>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.