Name = 'SignInForm'; $this->ValidActions = array('SignIn'); $this->Constructor($Context); if ($this->PostBackAction == '') $this->IsPostBack = 1; if ($this->IsPostBack) { $this->FormName = $FormName; $this->ReturnUrl = urldecode(ForceIncomingString('ReturnUrl', '')); if ($this->ReturnUrl != '') $this->PostBackParams->Add('ReturnUrl', $this->ReturnUrl); $this->Username = ForceIncomingString('Username', ''); $this->Password = ForceIncomingString('Password', ''); $this->RememberMe = ForceIncomingBool('RememberMe', 0); // Set up the page global $Banner, $Foot; $Banner->Properties['CssClass'] = 'SignIn'; $Foot->CssClass = 'SignIn'; $this->Context->PageTitle = $this->Context->GetDefinition('SignIn'); if ($this->PostBackAction == 'SignIn') { $UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager'); // Check for an already active session if ($this->Context->Session->UserID != 0) { $this->PostBackValidated = 1; } else { // Attempt to create a new session for the user if ($UserManager->ValidateUserCredentials($this->Username, $this->Password, $this->RememberMe)) { $this->PostBackValidated = 1; //Automatically redirect if this user isn't a user administrator or there aren't any new applicants $AutoRedirect = 1; if ($this->Context->Session->User->Permission('PERMISSION_APPROVE_APPLICANTS')) { $this->ApplicantCount = $UserManager->GetApplicantCount(); if ($this->ApplicantCount > 0) $AutoRedirect = 0; } if ($this->ReturnUrl == '') { $this->ReturnUrl = $this->Context->Configuration['FORWARD_VALIDATED_USER_URL']; } else { $this->ReturnUrl = str_replace('&', '&', $this->ReturnUrl); } if ($AutoRedirect && $this->ReturnUrl != '') { //@todo: Should the the process die here? Redirect($this->ReturnUrl, '302', '', 0); } } } } $this->Context->BodyAttributes = " onload=\"Focus('txtUsername');\""; } $this->CallDelegate('Constructor'); } function Render_ValidPostBack() { $this->CallDelegate('PreValidPostBackRender'); include(ThemeFilePath($this->Context->Configuration, 'people_signin_form_validpostback.php')); $this->CallDelegate('PostValidPostBackRender'); } function Render_NoPostBack() { $this->Username = FormatStringForDisplay($this->Username, 1); $this->PostBackParams->Add('PostBackAction', 'SignIn'); $this->PostBackParams->Add('ReturnUrl', $this->ReturnUrl); $this->CallDelegate('PreNoPostBackRender'); include(ThemeFilePath($this->Context->Configuration, 'people_signin_form_nopostback.php')); $this->CallDelegate('PostNoPostBackRender'); } // Because this form switches the user from having no session to having a session, // I need to override the default render method of the PostBackForm control so // that it doesn't check for a PostBackKey function Render() { if ($this->IsPostBack) { $this->CallDelegate('PreRender'); // Call different render methods based on the PostBack state. if ($this->PostBackValidated) { $this->Render_ValidPostBack(); } else { $this->Render_NoPostBack(); } $this->CallDelegate('PostRender'); } } } ?>