protected function btnFirstSubmit_Click($strFormId, $strControlId, $strParameter) { if ($objPublicLogin = PublicLogin::LoadByUsername(trim(strtolower($this->txtUsername->Text)))) { } else { $this->txtUsername->Warning = 'Username does not exist'; $this->txtUsername->Blink(); $this->txtUsername->Focus(); return; } $this->txtUsername->Visible = false; $this->btnFirstSubmit->Visible = false; $this->lblFirstMessage->Visible = true; $this->lblFirstMessage->HtmlEntities = false; $this->lblFirstMessage->Text = '<p>Before we can proceed, please answer the following security question that you specified when you registered for <strong>my.alcf</strong>.</p>'; $this->lblQuestion->Visible = true; $this->lblQuestion->Name = 'Security Question'; $this->lblQuestion->Text = $objPublicLogin->LostPasswordQuestion; if (QString::LastCharacter($objPublicLogin->LostPasswordQuestion) != '?') { $this->lblQuestion->Text .= '?'; } $this->txtAnswer->Visible = true; $this->txtAnswer->Name = 'Your Answer'; $this->txtAnswer->Required = true; $this->txtAnswer->CausesValidation = $this->txtAnswer; $this->txtAnswer->Focus(); $this->btnFinalSubmit->Visible = true; $this->btnFinalSubmit->Text = 'Reset My Password'; $this->btnFinalSubmit->CausesValidation = $this->txtAnswer; $this->txtAnswer->AddAction(new QEnterKeyEvent(), new QAjaxAction('btnFinalSubmit_Click')); $this->txtAnswer->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->btnFinalSubmit->AddAction(new QClickEvent(), new QAjaxAction('btnFinalSubmit_Click')); $this->objPublicLogin = $objPublicLogin; }
/** * Will check to see if a given username is creatable for a provisional account. If it is already * taken by a non-provisional account, this will return false. Otherwise, if it doesn't exist * (or the existing one is still provisional), it will return true. * @param $strUsername * @return boolean */ public static function IsProvisionalCreatableForUsername($strUsername) { $strUsername = QApplication::Tokenize($strUsername, false); if ($objPublicLogin = PublicLogin::LoadByUsername($strUsername)) { if ($objPublicLogin->Person) { return false; } } return true; }
protected function btnUpdate_Security_Click() { // Validate Security Stuff $blnProceed = true; $strUsernameCandidate = null; if ($this->txtUsername->Text != QApplication::$PublicLogin->Username) { $strUsernameCandidate = QApplication::Tokenize($this->txtUsername->Text, false); if ($strUsernameCandidate != trim(strtolower($this->txtUsername->Text))) { $this->txtUsername->Warning = 'Must only contain letters and numbers'; $blnProceed = false; } if (strlen($strUsernameCandidate) < 4) { $this->txtUsername->Warning = 'Must have at least 4 characters'; $blnProceed = false; } if (PublicLogin::LoadByUsername($strUsernameCandidate)) { $this->txtUsername->Warning = 'Username is taken'; $blnProceed = false; } } if ($this->txtOldPassword->Text || $this->txtNewPassword->Text || $this->txtConfirmPassword->Text) { if (!QApplication::$PublicLogin->IsPasswordValid($this->txtOldPassword->Text)) { $this->txtOldPassword->Warning = 'Password is incorrect'; $blnProceed = false; } if (strlen(trim($this->txtNewPassword->Text)) < 6) { $blnProceed = false; $this->txtNewPassword->Warning = 'Must have at least 6 characters'; } if ($this->txtNewPassword->Text != $this->txtConfirmPassword->Text) { $this->txtConfirmPassword->Warning = 'Does not match above'; $blnProceed = false; } } if (!$blnProceed) { $blnFirst = true; foreach ($this->GetErrorControls() as $objErrorControl) { $objErrorControl->Blink(); if ($blnFirst) { $blnFirst = false; $objErrorControl->Focus(); } } return; } // Update Stuff if ($strUsernameCandidate) { QApplication::$PublicLogin->Username = $strUsernameCandidate; } QApplication::$PublicLogin->LostPasswordQuestion = trim($this->txtQuestion->Text); QApplication::$PublicLogin->LostPasswordAnswer = strtolower(trim($this->txtAnswer->Text)); if ($this->txtNewPassword->Text) { QApplication::$PublicLogin->SetPassword($this->txtNewPassword->Text); QApplication::$PublicLogin->TemporaryPasswordFlag = false; } QApplication::$PublicLogin->Save(); // Refresh Stuff $this->mctPerson->Person->Reload(); $this->Refresh(); // Cleanup Stuff $this->btnCancel_Security_Click(); }
protected function btnConfirm_Click($strFormId, $strControlId, $strParameter) { $objPublicLogin = PublicLogin::LoadByUsername($this->txtUsername->Text); QApplication::PublicLogin($objPublicLogin); QApplication::Redirect('/register/details.php'); }