/**
  * 
  * @access public
  * @return void
  */
 public function sendAction()
 {
     $request = $this->getRequest();
     if ($request->isPost() && $this->_form->isValid($request->getPost())) {
         $mapper = new Model_Mapper_Auth();
         $mapper->setData($this->_form->getValues());
         $result = array('valid' => $mapper->recovery(), 'message' => $mapper->getMessage()->toArray());
     } else {
         $config = Zend_Registry::get('config');
         $message = new App_Message();
         $message->addMessage($config->messages->warning, App_Message::WARNING);
         $result = array('valid' => false, 'message' => $message->toArray(), 'error' => $this->_form->getMessages());
     }
     $this->_helper->json($result);
 }
Exemple #2
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);
     }
 }