Chris
Chris

Reputation: 805

cakePhp redirect and Auth doesn't work on server

I have a problem with login on www server. On wamp (local) everything wokrs fine. When I uploded my site on the server, login doesn't work and I see that rediret too. I have login form, after click login it goes to Users controller to login action. Login action looks like this:

    public function login(){
        if($this->request->is('post')){
            if($this->Auth->login()){
                $this->redirect($this->referer());
            }
            else{

                $this->Session->setFlash(__('Wrong username or password'));
                $this->redirect($this->referer());
            }
        }
    }

It should redirect both when success or not. It stays on: users/login page. What can be wrong?

AppController:

public $components = array(
    'Session',
    'Auth'=>array(
        'logoutRedirect'=>array('controller'=>'main', 'action'=>'index')
    )
);

public function beforeFilter(){
    $this->Auth->allow();

}

Form:

<?php

    echo $this->Form->create('User',  array('action' => 'login'));
    echo $this->Form->input('username', array('label'=>__('Username:')));
    echo $this->Form->input('password', array('label'=>__('Password:')));
    echo $this->Form->end(__('Login'));

?>

Upvotes: 1

Views: 1362

Answers (1)

Chris
Chris

Reputation: 805

There was a white space after ?> on one file.... After 3 hours I found out that that was bad :)

Upvotes: 3

Related Questions