Monday, July 26, 2010

Login Redirect

I am upgrading from 1.2 to 1.3 and when I try to login I get redirecting forever message. I never changed anything from 1.2 to my 1.3 version so maybe someone can point out my error.

 

Core.php

Configure::write('Routing.prefixes', array('admin'));

 

User_controller.php

function login() {

 

          $this->pageTitle = 'Administrator Login';

          if ( empty( $this->data ) ) {

              // Check to see if they are logged in

              if ( isset( $_SESSION['Auth']['User']['email'] ) ) {

                  $this->Session->setFlash(__('You are already logged in. ', true));

                  $this->redirect( array('admin' => true, 'controller' => 'users', 'action' => 'index' ) );

              }

          }

          if ( $this->Auth->user() ) {

                                    $this->redirect( array( 'admin' => true, 'controller' => 'users', 'action' => 'index' ) );   

          }

                       

      }

 

 

App_controller

 

function beforeFilter() {

                       

                        $this->Auth->allow('display');

                        $this->Auth->actionPath = 'Controllers/';

                        $this->Auth->authorize = 'controller';

                        $this->Auth->loginAction = '/login';

                        $this->Auth->logoutRedirect = '/';

                        $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'index', 'admin' => true);

                        //$this->Auth->userScope = array('User.confirmed' => '1');

                        $this->Auth->autoRedirect = false;

                        $this->Auth->loginError = "You have entered the wrong username or password.";

                        $this->Auth->authError = "Invalid Username or password.";                       

      }

 

Any ideas or anything I may have over looked?

 

Thanks

 

Dave

No comments: