Exemplo n.º 1
0
 /**
  * index action, check if the user has connected, 
  * @author EL GUENNUNI Sohaib s.elguennuni@gmail.com
  * @param <empty>
  * @return <empty>
  */
 public function indexAction()
 {
     if (BaseUser::isLogged()) {
         $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'wall', 'action' => 'index'), 'default', true));
     } else {
         $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'user', 'action' => 'login'), 'default', true));
     }
 }
Exemplo n.º 2
0
 /**
  * login action, Allow the User to connect
  * @author EL GUENNUNI Sohaib s.elguennuni@gmail.com
  * @param <empty>
  * @return <empty>
  */
 public function loginAction()
 {
     if (BaseUser::isLogged()) {
         $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'wall', 'action' => 'index'), 'default', true));
     }
     $this->title = 'Login';
     $form = new LoginForm();
     if ($this->getRequest()->isPost()) {
         if ($registration = $this->getRequest()->getParam('inscription', false)) {
             $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'user', 'action' => 'add'), 'default', true));
         }
         if ($form->isValid($this->getRequest()->getPost())) {
             if ($this->_userModel->login($form->getValue('username'), $form->getValue('password'))) {
                 $member = App_Utilities::setMember_Registry();
                 if ($member->validate == 1) {
                     $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'wall', 'action' => 'index'), 'default', true));
                 } else {
                     Zend_Auth::getInstance()->clearIdentity();
                     Zend_Session::destroy();
                     $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'user', 'action' => 'login'), 'default', true));
                 }
             }
         } else {
             $this->_authentification->addFailedLogin();
         }
         $this->view->error = TRUE;
     }
     $this->view->form = $form;
 }