Exemple #1
0
 /**
  * @return bool|mixed
  */
 public function getData()
 {
     if ($this->storage->isEmpty()) {
         return [];
     }
     return $this->storage->read();
 }
 public function read()
 {
     $className = $this->getClassResolver()->resolveClassName('User\\Entity\\UserInterface');
     $id = parent::read();
     $user = $this->getObjectManager()->find($className, $id);
     if (!$user) {
         throw new UserNotFoundException(sprintf('User %s not found', $id));
     }
     return $user;
 }
Exemple #3
0
 public function registerAction()
 {
     $ses = new SessionStorage();
     var_dump($ses->read());
     $form = new UserForm();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $user = $request->getPost();
         $lola = $this->userService->register($user);
         \Zend\Debug\Debug::dump($lola);
     }
     return array('form' => $form);
 }
 public function indexAction()
 {
     $authService = $this->GetAuthenticationService();
     if (!$authService->hasIdentity()) {
         //
         //  Set the redirect url in the session
         //
         $sessionContainer = new Container();
         $sessionContainer->redirect_url = $this->getRequest()->getUriString();
         return array('loginForm' => new LoginForm(), 'courseList' => $this->GetCourseModel()->FetchNewestCourseMetadata(6));
     } else {
         $session = new Session();
         $username = $session->read();
         $profileModel = $this->GetProfileModel();
         $profile = $profileModel->FetchProfileByUsername($username);
         $courseModel = $this->GetCourseModel();
         $profileForm = new ProfileForm();
         $profileForm->setData($profile->GetArrayCopy());
         //setting existing data from the database
         //$gradeModel = $this->GetGradeModel();
         return array('user' => $profile, 'myCourseList' => $courseModel->FetchMyCourses($profile->id), 'myProfileForm' => $profileForm);
     }
 }
Exemple #5
0
 /**
  * 验证登录
  * @param $platform
  * @return bool|mixed
  */
 protected function checkLogin($platform = self::FRONT_PLATFORM)
 {
     if ($platform == self::FRONT_PLATFORM) {
         /*$token = $this->postData['token'];
                     if (!empty($token)){
                         $tokenInfo = $this->tokenModel->select(array('token' => $token))->current();
                         if(!empty($tokenInfo)){
                             $this->memberInfo = $this->memberInfoModel->select(array('memberID' => $tokenInfo['memberID']))->current();
                         }
         
                     }*/
         $autoCode = $_COOKIE['autoCode'];
         if (!empty($autoCode)) {
             $this->memberInfo = $this->memberInfoModel->select(array('autoCode' => $autoCode))->current();
         } else {
             $loginSession = new Session($platform, null, null);
             $this->memberInfo = $session = $loginSession->read();
             if (!empty($this->memberInfo['memberID'])) {
                 $this->memberInfo = $this->memberInfoModel->select(array('memberID' => $this->memberInfo['memberID']))->current();
             }
         }
     } else {
         $loginSession = new Session($platform, null, null);
         $this->adminInfo = $session = $loginSession->read();
     }
     if (empty($this->memberInfo) && empty($this->adminInfo)) {
         return false;
     } else {
         return true;
     }
 }
 /**
  * Will return the key of the identity. If only the key is needed, this avoids an
  * unnecessary db call
  *
  * @return mixed
  */
 public function readKeyOnly()
 {
     return $identity = parent::read();
 }