Esempio n. 1
0
 public function ajaxAction()
 {
     parent::ajaxAction();
     $data = (object) array_merge($this->getRequest()->getPost(), $_GET);
     $this->_ajaxResponse = new stdClass();
     switch ($data->type) {
         case 'userLogin':
             $this->_ajaxResponse->login = 0;
             /* @var Application_Model_User_Profile $profileClass */
             $profileClass = RM_Dependencies::getInstance()->userProfile;
             $profile = $profileClass::getByEmail($data->mail);
             /* @var RM_User_Profile_Interface $profile */
             if ($profile instanceof $profileClass && $profile->checkPassword($data->passwd)) {
                 if ($profile->getUser()->getRole()->isAdmin()) {
                     $this->_session->create($profile->getUser());
                     if (intval($data->remember) == 1) {
                         $this->_session->remember();
                     }
                     $this->_ajaxResponse->login = 2;
                 } else {
                     $this->_ajaxResponse->login = 1;
                 }
             }
             break;
     }
 }
Esempio n. 2
0
 protected function _initDependencies()
 {
     $dependencies = RM_Dependencies::getInstance();
     $dependencies->userClass = 'RM_User_Base';
     $dependencies->userProfile = 'Application_Model_User_Profile';
     $dependencies->pageClass = 'Application_Model_TextPage';
 }