function checkUser()
 {
     $user = $this->getSession()->get('user');
     if (empty($user)) {
         $bag = new Bag();
         $bag->set('loginerror', 'FORBIDDEN, you need to log in first!!!');
         $this->redirect('admin');
     }
 }
 /**
  * This is the main function of the class
  * @return void
  */
 function indexAction()
 {
     $post = $this->gPOST();
     $signin = $post->signin;
     //check in db
     $OK = $this->validate($signin);
     if (!$OK) {
         $bag = new Bag();
         $bag->set('loginerror', 'The email or password does not match the records.');
         $this->redirect('admin');
     } else {
         $this->redirect('dashboard');
     }
 }
示例#3
0
 function indexAction()
 {
     //checkUser
     $this->checkUser();
     $includer = new Includer();
     $components = $includer->getComponents();
     $components_list = array($components['jquery'], $components['bootstrap'], $components['components-font-awesome'], $components['fonts'], $components['livereload']);
     $this->set('components', $components_list);
     //Check Bag
     $bag = new Bag();
     $loginerror = $bag->get('loginerror');
     if ($loginerror) {
         $this->set('msg', '<div class="alert alert-danger">' . $loginerror . '</div>');
     } else {
         $this->set('msg', 'This is the admin area. Please enter your credentials below.');
     }
     $this->set('logo', array('src' => '//static.pixeledchimp.me/img/mush.png', 'alt' => 'Mush'));
     $this->render('admin/login.html.twig');
 }