Fabien Piron
Fabien Piron

Reputation: 209

CakePHP auth redirection not working

In order to learn cakephp i am trying to reproduce the simple authentication example of the cookbook ; http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html

My problem is that when i try to access a non authorized page i just got a blank page with the cake installation notice warning : please change the valie of secruity salt and cipherSeed

here is my code for the appcontroller

class AppController extends Controller {

public $components = array(
    'Session',
    'Auth' => array(
        'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
        'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home')
    ),
    'RequestHandler'
);

public function beforeFilter() {
    $this->Auth->allow('index', 'view', 'login');
    $this->Auth->authorize = 'actions';
    $this->Auth->autoRedirect   = true;
}

} and here is my code for the usercontroller

public function beforeFilter() {
        parent::beforeFilter();
        $this->Auth->allow('add');
    }

    public function login() {
        echo "i am called";
        if ($this->request->is('post')) {
            if ($this->Auth->login()) {
                $this->redirect($this->Auth->redirect());
            } else {
                $this->Session->setFlash(__('Invalid username or password, try again'));
            }
        }
    }

    public function logout() {
        $this->redirect($this->Auth->logout());
    }

s there any configuration that i don't do or any misunderstanding problem about auth implementation ?

i am using easyPhp for windows as my webserver , but i also have the issue on a linux installation with php5 , mysql and apache 2

Upvotes: 0

Views: 1463

Answers (1)

kaklon
kaklon

Reputation: 2432

Cipher and salt are found in app/Config/core.php, you must change them

Upvotes: 1

Related Questions