hi Cake Community,
CakePHP 2.0.2
OS: Windows7
Configure::write('debug', 2);
Problem:
My Auth Component is not working and i dont know why. Need Help.
User Controller:
<?php
class UsersController extends AppController {
public $components = array('Auth','Security');
public function login() {
if ($this->request->is('post')) {
class UsersController extends AppController {
public $components = array('Auth','Security');
public function login() {
if ($this->request->is('post')) {
/* $this->Auth->User('usr') or $this->Auth->User('pwd') ....also tried. Returns nothing. Dont know why!?!?! */
if ($this->Auth->Login()) {
$this->redirect(array('controller' => 'PricerobotStoreEngines', 'action' => 'index'));
} else {
$this->Session->setFlash(__('Username or password is incorrect'));
$this->redirect(array('controller' => 'users', 'action' => 'login'));
}
}
}
public function logout() {
$this->redirect($this->Auth->logout());
}
/*
* tried,too ! Returns nothing.
*
public function beforeFilter(){
// $this->Auth->User('usr') or $this->Auth->User('pwd') ....also tried. Returns nothing. Dont know why!?!?!
}
*
*
*/
}
?>
PricerobotStoreEnginesController Controller:
<?php
class PricerobotStoreEnginesController extends AppController {
public $components = array(
'Auth'=> array(
'loginAction' => array(
'controller' => 'users',
'action' => 'login',
)
)
);
class PricerobotStoreEnginesController extends AppController {
public $components = array(
'Auth'=> array(
'loginAction' => array(
'controller' => 'users',
'action' => 'login',
)
)
);
}
?>
Login View:
<?php
echo $this->Form->create('');
echo $this->Form->input('usr');
echo $this->Form->password('pwd');
echo $this->Form->end('Login');
?>
echo $this->Form->create('');
echo $this->Form->input('usr');
echo $this->Form->password('pwd');
echo $this->Form->end('Login');
?>
No comments:
Post a Comment