コード例 #1
0
 public function tryRegister(UserCredentials $uc, &$user)
 {
     $this->userName = $uc->getUserName();
     $this->password = $uc->getPassword();
     $user = new User($this->userName, $this->password);
     if (!User::checkIfUserExists($this->userName)) {
         User::AddUser($user);
         $this->validRegister = true;
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: UserCredentials.php プロジェクト: ao222qc/IDV608_2
 public function validateRegistrationFormData()
 {
     if (is_numeric($this->userNameInput) || strlen($this->userNameInput) < 3 || $this->userNameInput == NULL && $this->passwordInput == NULL) {
         $this->messageKey = FeedbackStrings::UNAMEFAIL;
     } else {
         if (strlen($this->passwordInput) < 6) {
             $this->messageKey = FeedbackStrings::PWORDFAIL;
         } else {
             if ($this->repeatedPasswordInput != $this->passwordInput) {
                 $this->messageKey = FeedbackStrings::REPEATPASSWORDFAIL;
             } else {
                 if (preg_match('/[^A-Za-z0-9.#\\-$]/', $this->userNameInput)) {
                     $this->messageKey = FeedbackStrings::INVALIDCHARFAIL;
                 } else {
                     if (User::checkIfUserExists($this->userNameInput)) {
                         $this->messageKey = FeedbackStrings::UNAMEEXISTSFAIL;
                     }
                 }
             }
         }
     }
     return $this->messageKey;
 }