/**
  * @param IPresentationSpeaker $speaker
  * @param string $email
  * @return ISpeakerRegistrationRequest
  */
 public function build(IPresentationSpeaker $speaker, $email)
 {
     $request = new SpeakerRegistrationRequest();
     $request->Email = $email;
     $request->IsConfirmed = false;
     $request->SpeakerID = $speaker->getIdentifier();
     $request->ProposerID = Member::currentUserID();
     $already_exists = false;
     do {
         $token = $request->generateConfirmationToken();
         $already_exists = $this->repository->existsConfirmationToken($token);
     } while ($already_exists);
     return $request;
 }
 /**
  * Check for auth tokens
  * @return mixed
  */
 public function init()
 {
     parent::init();
     if (!Summit::get_active()->isInDB()) {
         return $this->httpError(404, 'There is no active summit');
     }
     /**
      * On the existing tokenauthentication system, this is a fairly trivialmatter, and I'm not so sure it's anything to navigate right now.
      * Thiswas implemented to provide the video upload people a simple API foradding videos. It's a very specific use c
      * ase, and general users shouldnot be using it. If they can and they are, then that needs to bechanged.
      */
     $result = $this->checkAuthenticationToken();
     if (!$result && !Member::currentUser()) {
         //check if speaker registration token is present..
         $speaker_registration_token = $this->request->getVar(SpeakerRegistrationRequest::ConfirmationTokenParamName);
         if (!is_null($speaker_registration_token)) {
             $request = $this->speaker_registration_request_repository->getByConfirmationToken($speaker_registration_token);
             if (is_null($request) || $request->alreadyConfirmed()) {
                 return SummitSecurity::permission_failure($this);
             }
             // redirect to register member speaker
             $url = Controller::join_links(Director::baseURL(), 'summit-login', 'registration');
             return $this->redirect($url . '?BackURL=' . urlencode($this->request->getURL()) . '&' . SpeakerRegistrationRequest::ConfirmationTokenParamName . '=' . $speaker_registration_token);
         }
         return SummitSecurity::permission_failure($this);
     }
     $speaker = Member::currentUser()->getCurrentSpeakerProfile();
     if (!$speaker) {
         $speaker = PresentationSpeaker::create(array('MemberID' => Member::currentUserID(), 'SummitID' => Summit::get_active()->ID, 'FirstName' => Member::currentUser()->FirstName, 'LastName' => Member::currentUser()->Surname));
         $speaker->write();
     }
 }
 /**
  * Check for auth tokens
  * @return mixed
  */
 public function init()
 {
     parent::init();
     if (!Summit::get_active()->isInDB()) {
         return $this->httpError(404, 'There is no active summit');
     }
     /**
      * On the existing tokenauthentication system, this is a fairly trivialmatter, and I'm not so sure it's anything to navigate right now.
      * Thiswas implemented to provide the video upload people a simple API foradding videos. It's a very specific use c
      * ase, and general users shouldnot be using it. If they can and they are, then that needs to bechanged.
      */
     $result = $this->checkAuthenticationToken();
     if (!$result && !Member::currentUser()) {
         //check if speaker registration token is present..
         $speaker_registration_token = $this->request->getVar(SpeakerRegistrationRequest::ConfirmationTokenParamName);
         if (!is_null($speaker_registration_token)) {
             // send it to SummitSecurity Controller to complete speaker registration
             $request = $this->speaker_registration_request_repository->getByConfirmationToken($speaker_registration_token);
             if (is_null($request) || $request->alreadyConfirmed()) {
                 return $this->httpError(404);
             }
             // redirect to register member speaker
             $url = Controller::join_links(Director::baseURL(), 'summit-login', 'registration');
             Session::set(SpeakerRegistrationRequest::ConfirmationTokenParamName, $speaker_registration_token);
             Session::set('BackURL', $this->request->getURL());
             return $this->redirect($url);
         }
         return SummitSecurity::permission_failure($this);
     }
     $this->speaker_manager->ensureSpeakerProfile(Member::currentUser());
 }
Пример #4
0
 public function registration()
 {
     $speaker_registration_token = Controller::curr()->getRequest()->requestVar(SpeakerRegistrationRequest::ConfirmationTokenParamName);
     if (!empty($speaker_registration_token)) {
         $request = $this->speaker_registration_request_repository->getByConfirmationToken($speaker_registration_token);
         if (is_null($request) || $request->alreadyConfirmed()) {
             return $this->httpError(404, 'speaker registration request not found!');
         }
     }
     return $this->customiseSummitPage(array())->renderWith(array('SummitSecurity_registration', 'SummitPage'), $this);
 }