function StartSurvey($data, $form)
 {
     try {
         $data = SQLDataCleaner::clean($data);
         $data['MembershipType'] = 'community';
         Session::set("FormInfo.{$form->FormName()}.data", $data);
         $profile_page = EditProfilePage::get()->first();
         $member = $this->member_manager->registerMobile($data, new MemberRegistrationSenderService());
         //Get profile page
         if (!is_null($profile_page)) {
             //Redirect to profile page with success message
             Session::clear("FormInfo.{$form->FormName()}.data");
             $request = Controller::curr()->getRequest();
             $back_url = $request->postVar('BackURL');
             $link = $profile_page->Link('?success=1');
             if (!empty($back_url)) {
                 $link .= "&BackURL=" . $back_url;
             }
             return OpenStackIdCommon::loginMember($member, $link);
         }
     } catch (EntityValidationException $ex1) {
         Form::messageForForm($form->FormName(), $ex1->getMessage(), 'bad');
         //Return back to form
         SS_Log::log($ex1->getMessage(), SS_Log::WARN);
         return Controller::curr()->redirectBack();
     } catch (Exception $ex) {
         Form::messageForForm($form->FormName(), "There was an error with your request, please contact your admin.", 'bad');
         //Return back to form
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return Controller::curr()->redirectBack();
     }
 }
Ejemplo n.º 2
0
 function doRegister($data, $form)
 {
     try {
         $data = SQLDataCleaner::clean($data, $non_check_keys = array('HiddenAffiliations'));
         Session::set("FormInfo.{$form->FormName()}.data", $data);
         $profile_page = EditProfilePage::get()->first();
         $member = $this->member_manager->register($data, $profile_page, new MemberRegistrationSenderService());
         //Get profile page
         if (!is_null($profile_page)) {
             //Redirect to profile page with success message
             Session::clear("FormInfo.{$form->FormName()}.data");
             return OpenStackIdCommon::loginMember($member, $profile_page->Link('?success=1'));
         }
     } catch (EntityValidationException $ex1) {
         Form::messageForForm('HoneyPotForm_RegistrationForm', $ex1->getMessage(), 'bad');
         //Return back to form
         SS_Log::log($ex1->getMessage(), SS_Log::ERR);
         return $this->redirectBack();
     } catch (Exception $ex) {
         Form::messageForForm('HoneyPotForm_RegistrationForm', "There was an error with your request, please contact your admin.", 'bad');
         //Return back to form
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return $this->redirectBack();
     }
 }
Ejemplo n.º 3
0
 /**
  * Handles the registration. Validates and creates the member, then redirects
  * to the appropriate place
  *  
  * @param  array $data
  * @param  BootstrapForm $form
  * @return SSViewer
  */
 public function doRegister($data, $form)
 {
     try {
         $back_url = Session::get('BackURL');
         Session::set("FormInfo.{$form->getName()}.data", $data);
         $data = SQLDataCleaner::clean($data);
         $profile_page = EditProfilePage::get()->first();
         $speaker_registration_token = Session::get(SpeakerRegistrationRequest::ConfirmationTokenParamName);
         if (!empty($speaker_registration_token)) {
             $data[SpeakerRegistrationRequest::ConfirmationTokenParamName] = $speaker_registration_token;
         }
         $member = $this->member_manager->registerSpeaker($data, new MemberRegistrationSenderService());
         //Get profile page
         if (!is_null($profile_page)) {
             //Redirect to profile page with success message
             Session::clear("FormInfo.{$form->FormName()}.data");
             if ($back_url) {
                 $redirect = HTTP::setGetVar('welcome', 1, $back_url);
                 return OpenStackIdCommon::loginMember($member, $redirect);
             }
             $form->sessionMessage('Awesome! You should receive an email shortly.', 'good');
             Session::clear(SpeakerRegistrationRequest::ConfirmationTokenParamName);
             Session::clear('BackURL');
             return OpenStackIdCommon::loginMember($member, $this->redirectBackUrl());
         }
     } catch (EntityValidationException $ex1) {
         Form::messageForForm($form->FormName(), $ex1->getMessage(), 'bad');
         //Return back to form
         SS_Log::log($ex1->getMessage(), SS_Log::WARN);
         return $this->redirectBack();
     } catch (Exception $ex) {
         Form::messageForForm($form->FormName(), "There was an error with your request, please contact your admin.", 'bad');
         //Return back to form
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return $this->redirectBack();
     }
 }