Example #1
0
 /**
  * 
  * @access public
  * @return void
  */
 public function loginAction()
 {
     if ($this->getRequest()->isPost()) {
         $form = $this->_getFormAuth();
         if ($form->isValid($this->getRequest()->getPost())) {
             $mapper = new Model_Mapper_Auth();
             $mapper->setData($form->getValues());
             $result = array('valid' => $mapper->login(), 'message' => $mapper->getMessage()->toArray());
         } else {
             $message = new App_Message();
             $message->addMessage($this->_config->messages->warning, App_Message::WARNING);
             $result = array('valid' => false, 'message' => $message->toArray(), 'error' => $form->getMessages());
         }
         $this->_helper->json($result);
     }
 }