function login($err = null)
 {
     $this->redirect('/users/landing');
     $this->layout = 'dynamic';
     $this->set('title', '/img/landing/flyfoenix_landingpage_joinshopsave.png');
     $this->set('titleCSS', 'position:absolute;top:-30px;left:115px;z-index:100;');
     $this->set('classWidth', 'width-custom');
     $this->set('bgImg', '/img/schools/background/flyfoenix_landingpage_background_03.jpg');
     $this->set('shareImage', 'http://www.flyfoenix.com/img/referral.jpg');
     $this->set('jsFilesBottom', array('/js/miocarousel.js'));
     //force logged-in users to shop
     if ($this->Auth->user()) {
         $this->redirect(array('controller' => 'shop', 'action' => 'main'));
     }
     //set whether or not user should see fb popup
     if (!$this->Cookie->read('firsttime')) {
         $this->Cookie->write('firsttime', '1', false);
         $this->set('showFBprompt', true);
     } else {
         $this->set('showFBprompt', false);
     }
     //add the carousel images
     $this->addCarouselImages();
     //if there was a login error from register or login
     if (!empty($err)) {
         $error = new MyError($err);
         $this->set('error', $error->getJson());
         $errors[$error->getDOMid()] = $error;
         $this->set('errors', $errors);
         return;
     }
     //AuthComponent does not encrypt password by default if the you are not
     //using "username" as the identifier.
     if (!empty($this->data)) {
         //look for user
         if (!$this->User->checkEmailExists($this->data)) {
             $error = new MyError('no_user');
             $this->set('error', $error->getJson());
             $errors[$error->getDOMid()] = $error;
             $this->set('errors', $errors);
             return;
         }
         //encrypt password
         $this->data['User']['password'] = AuthComponent::password($this->data['User']['birthdate']);
         //login the user
         if ($this->Auth->login($this->data)) {
             //handle the remember me
             if (empty($this->data['User']['remember_me'])) {
                 $this->RememberMe->delete();
             } else {
                 $this->RememberMe->remember($this->data['User']['email'], $this->data['User']['password']);
             }
             //user is logged in, forward to the shop
             $this->redirect(array('controller' => 'shop', 'action' => 'main'));
             return;
         } else {
             $error = new MyError('bad_password');
             $this->set('error', $error->getJson());
             $errors[$error->getDOMid()] = $error;
             $this->set('errors', $errors);
             return;
         }
     }
     $error = new MyError('no_error');
     $this->set('error', $error->getJson());
     //$this->redirect($this->Auth->redirect());
 }