2015-07-02 2 views
0

CakePhp 2 цикл переадресации на веб-хостинг. Но он работает на локальном компьютере. Кто-нибудь может решить мою проблему?Cakephp 2 Auth Redirect Loop

Это мой AppController

class AppController extends Controller { 

public $components = array(
    'Acl', 
    'Auth' => array(
     'authorize' => array(
      'Actions' => array('actionPath' => 'controllers') 
     ), 
     'authenticate' => array(
      'Form' => array(
       'scope' => array('User.status' => '1') 
      ), 
     ), 
    ), 
    'Session', 
    'DebugKit.Toolbar', 
); 

public $helpers = array('Html', 'Form', 'Session'); 

public $uses = array(
    'Configuration.Configuration', 
    'EmailTemplate.EmailTemplate', 
); 


public $theme = ""; 


public function beforeFilter() { 

    //Configure AuthComponent 
    $this->Configuration->load(); 
    $this->Auth->loginAction = array(
     'controller' => 'users', 
     'action' => 'login', 
     'plugin' => false 
    ); 
    $this->Auth->logoutRedirect = array(
     'controller' => 'users', 
     'action' => 'login', 
     'plugin' => false 
    ); 
    $this->Auth->loginRedirect = array(
     'controller' => 'users', 
     'action' => 'dashboard', 
     'plugin' => false 
    ); 

    $this->check_group(); 
    ####### Define Plugin layout ####### 
     if($this->params['plugin']=='content') 
     $this->layout = 'content'; 

} 

private function check_group() 
{ 
    $this->theme = 'CakeReady'; 

    if (isset($this->request->params['admin'])) { 
     $this->layout = 'admin'; 
    } 

    if ($this->params['plugin'] == 'acl') { 
     $this->layout = 'acl'; 
    } 

    if ($this->request->is('ajax')) { 
     $this->layout = 'ajax'; 
    } 

    if(!isset($this->request->params['admin']) && Configure::read('Site.coming_soon') == 1){ 
     $this->theme = 'CakeReady'; 
     $this->layout = 'coming_soon'; 
     $this->set('title_for_layout', __('Coming Soon')); 
    } 
    else if (!isset($this->request->params['admin']) && Configure::read('Site.status') == 0){ 
     $this->theme = 'CakeReady'; 
     $this->layout = 'maintenance'; 
     $this->set('title_for_layout', __('Site down for maintenance')); 
    } 
    else if (!isset($this->request->params['admin'])){ 
     $this->theme = 'CakeReady'; 
     $this->layout = 'coming_soon'; 
     $this->set('title_for_layout', __('Coming Soon')); 
    } 

} 

И его мой UsersController

class UsersController extends AppController { 

/** * Компоненты * * @var массив */

public $components = array('Paginator','Qimage'); 

public function beforeFilter() { 
    parent::beforeFilter(); 
    $this->Auth->allow('admin_forget_password', 'login', 'admin_login','subscriber','activate_code', 'register', 'captcha'); 
} 

public function login() { 
    $show_action = 'login'; 
    $this->layout = 'admin_login'; 
    if ($this->request->is('post')) { 
     if ($this->Auth->login()) { 
      $this->Session->setFlash(__('Congratulation You are login succcessfully.'), 'success'); 
      return $this->redirect($this->Auth->redirect()); 
     } 
     $this->Session->setFlash(__('<h4>Your username or password was incorrect.</h4>'), 'errorText'); 
    } 
    $this->set(compact('show_action')); 
} 

/** * Метод admin_login * * @return пустота */

public function admin_login() { 
    $show_action = 'login'; 
    $this->layout = 'admin_login'; 
    if ($this->request->is('post')) { 
     if ($this->Auth->login()) { 
      $this->Session->setFlash(__('Congratulation You are login succcessfully.'), 'success'); 
      return $this->redirect($this->Auth->redirect()); 
     } 
     $this->Session->setFlash(__('<h4>Your username or password was incorrect.</h4>'), 'errorText'); 
    } 
    $this->set(compact('show_action')); 
} 

ответ

0

включен mod_rewrite?

У вас тоже есть?

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule ^$ webroot/ [L] 
    RewriteRule (.*) webroot/$1 [L] 
</IfModule> 
+0

не работает .. спасибо за ваш ответ –

Смежные вопросы