Beispiel #1
0
 protected function Form_Validate()
 {
     $blnToReturn = true;
     $strUsernameCandidate = QApplication::Tokenize($this->txtUsername->Text, false);
     if ($strUsernameCandidate != trim(strtolower($this->txtUsername->Text))) {
         $this->txtUsername->Warning = 'Must only contain letters and numbers';
         $blnToReturn = false;
     }
     if (strlen($strUsernameCandidate) < 4) {
         $this->txtUsername->Warning = 'Must have at least 4 characters';
         $blnToReturn = false;
     }
     if (!PublicLogin::IsProvisionalCreatableForUsername($strUsernameCandidate)) {
         $this->txtUsername->Warning = 'Username already in use by another account';
         $blnToReturn = false;
     }
     if (!Email::IsAvailableForPublicRegistration($this->txtEmail->Text)) {
         $this->txtEmail->Warning = 'Email already in use by another account';
         $blnToReturn = false;
     }
     // Check "First Name" to ensure no & or " and "
     $strFirstName = trim(strtolower($this->txtFirstName->Text));
     if (strpos($strFirstName, ' and ') !== false || strpos($strFirstName, '&') !== false || strpos($strFirstName, ',') !== false) {
         $this->txtFirstName->Warning = 'Please only register one person per account.  For couples or families, you can register each person as different individual accounts.';
         $blnToReturn = false;
     }
     $blnFirst = true;
     foreach ($this->GetErrorControls() as $objControl) {
         if ($blnFirst) {
             $blnFirst = false;
             $objControl->Focus();
         }
         $objControl->Blink();
     }
     return $blnToReturn;
 }
Beispiel #2
0
 protected function Form_Validate()
 {
     $blnToReturn = true;
     $strUsernameCandidate = QApplication::Tokenize($this->txtUsername->Text, false);
     if ($strUsernameCandidate != trim(strtolower($this->txtUsername->Text))) {
         $this->txtUsername->Warning = 'Must only contain letters and numbers';
         $blnToReturn = false;
     }
     if (strlen($strUsernameCandidate) < 4) {
         $this->txtUsername->Warning = 'Must have at least 4 characters';
         $blnToReturn = false;
     }
     if (!PublicLogin::IsProvisionalCreatableForUsername($strUsernameCandidate)) {
         $this->txtUsername->Warning = 'Username already in use by another account';
         $blnToReturn = false;
     }
     // Test Password
     if (strlen(trim($this->txtPassword->Text)) < 6) {
         $blnToReturn = false;
         $this->txtPassword->Warning = 'Your password is too short';
     }
     if ($this->txtPassword->Text != $this->txtConfirmPassword->Text) {
         $this->txtConfirmPassword->Warning = 'Does not match above';
         $blnToReturn = false;
     }
     $blnFirst = true;
     foreach ($this->GetErrorControls() as $objControl) {
         if ($blnFirst) {
             $blnFirst = false;
             $objControl->Focus();
         }
         $objControl->Blink();
     }
     return $blnToReturn;
 }