Esempio n. 1
0
 public function HandleSelfRegistration(User $user, IRegistrationPage $page, ILoginContext $loginContext)
 {
     if ($user->StatusId() == AccountStatus::ACTIVE) {
         Log::Debug('PostRegistration - Handling activate user %s', $user->EmailAddress());
         $this->authentication->Login($user->EmailAddress(), $loginContext);
         $page->Redirect(Pages::UrlFromId($user->Homepage()));
     } else {
         Log::Debug('PostRegistration - Handling pending user %s', $user->EmailAddress());
         $this->activation->Notify($user);
         $page->Redirect(Pages::ACTIVATION);
     }
 }
Esempio n. 2
0
 public function PageLoad()
 {
     $activationCode = $this->page->GetActivationCode();
     if (empty($activationCode)) {
         $this->page->ShowSent();
     } else {
         $activationResult = $this->accountActivation->Activate($activationCode);
         if ($activationResult->Activated()) {
             $user = $activationResult->User();
             $this->authentication->Login($user->EmailAddress(), new WebLoginContext(new LoginData(false, $user->Language())));
             $this->page->Redirect(Pages::UrlFromId($user->Homepage()));
         } else {
             $this->page->ShowError();
         }
     }
 }
Esempio n. 3
0
 public function Logout()
 {
     $url = Configuration::Instance()->GetKey(ConfigKeys::LOGOUT_URL);
     if (empty($url)) {
         $url = htmlspecialchars_decode($this->_page->GetResumeUrl());
         $url = sprintf('%s?%s=%s', Pages::LOGIN, QueryStringKeys::REDIRECT, urlencode($url));
     }
     $this->authentication->Logout(ServiceLocator::GetServer()->GetUserSession());
     $this->_page->Redirect($url);
 }