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); } }
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(); } } }
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); }