當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserUtil::isAvailableUsername方法代碼示例

本文整理匯總了PHP中UserUtil::isAvailableUsername方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserUtil::isAvailableUsername方法的具體用法?PHP UserUtil::isAvailableUsername怎麽用?PHP UserUtil::isAvailableUsername使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserUtil的用法示例。


在下文中一共展示了UserUtil::isAvailableUsername方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validate

 /**
  * @see	Form::validate()
  */
 public function validate()
 {
     parent::validate();
     // only for guests
     if (WCF::getUser()->userID == 0) {
         // username
         if (empty($this->username)) {
             throw new UserInputException('username');
         }
         if (!UserUtil::isValidUsername($this->username)) {
             throw new UserInputException('username', 'notValid');
         }
         if (!UserUtil::isAvailableUsername($this->username)) {
             throw new UserInputException('username', 'notAvailable');
         }
         WCF::getSession()->setUsername($this->username);
     } else {
         $this->username = WCF::getUser()->username;
     }
 }
開發者ID:Evil-Co-Legacy,項目名稱:Bash-Database,代碼行數:23,代碼來源:NewsAddForm.class.php

示例2: validateUsername

 /**
  * Validates the username
  */
 protected function validateUsername()
 {
     if (!WCF::getUser()->userID) {
         if (empty($this->username)) {
             throw new UserInputException('username');
         }
         if (!UserUtil::isValidUsername($this->username)) {
             throw new UserInputException('username', 'notValid');
         }
         if (!UserUtil::isAvailableUsername($this->username)) {
             throw new UserInputException('username', 'notAvailable');
         }
         WCF::getSession()->setUsername($this->username);
     } else {
         $this->username = WCF::getUser()->username;
     }
 }
開發者ID:0xLeon,項目名稱:com.leon.pokemon.cheatdatabase.core,代碼行數:20,代碼來源:CheatDatabaseEntryAddForm.class.php

示例3: validateUsername

 /**
  * Throws a UserInputException if the username is not unique or not valid.
  * 
  * @param	string		$username
  */
 protected function validateUsername($username)
 {
     if (empty($username)) {
         throw new UserInputException('username');
     }
     // check for forbidden chars (e.g. the ",")
     if (!UserUtil::isValidUsername($username)) {
         throw new UserInputException('username', 'notValid');
     }
     // Check if username exists already.
     if (!UserUtil::isAvailableUsername($username)) {
         throw new UserInputException('username', 'notUnique');
     }
 }
開發者ID:CaribeSoy,項目名稱:contest-wcf,代碼行數:19,代碼來源:UserAddForm.class.php

示例4: validate

 /**
  * @see Form::validate()
  */
 public function validate()
 {
     parent::validate();
     // password
     if (empty($this->password)) {
         throw new UserInputException('password');
     }
     if (!WCF::getUser()->checkPassword($this->password)) {
         throw new UserInputException('password', 'false');
     }
     // username
     if ($this->canChangeUsername && $this->username != WCF::getUser()->username) {
         if (StringUtil::toLowerCase($this->username) != StringUtil::toLowerCase(WCF::getUser()->username)) {
             // check for forbidden chars (e.g. the ",")
             if (!UserRegistrationUtil::isValidUsername($this->username)) {
                 throw new UserInputException('username', 'notValid');
             }
             // Check if username exists already.
             if (!UserUtil::isAvailableUsername($this->username)) {
                 throw new UserInputException('username', 'notUnique');
             }
         }
     }
     // password
     if (!empty($this->newPassword) || !empty($this->confirmNewPassword)) {
         if (empty($this->newPassword)) {
             throw new UserInputException('newPassword');
         }
         if (empty($this->confirmNewPassword)) {
             throw new UserInputException('confirmNewPassword');
         }
         if (!UserRegistrationUtil::isSecurePassword($this->newPassword)) {
             throw new UserInputException('newPassword', 'notSecure');
         }
         if ($this->newPassword != $this->confirmNewPassword) {
             throw new UserInputException('confirmNewPassword', 'notEqual');
         }
     }
     // email
     if (WCF::getUser()->getPermission('user.profile.canChangeEmail') && $this->email != WCF::getUser()->email && $this->email != WCF::getUser()->newEmail) {
         if (empty($this->email)) {
             throw new UserInputException('email');
         }
         // check if only letter case is changed
         if (StringUtil::toLowerCase($this->email) != StringUtil::toLowerCase(WCF::getUser()->email)) {
             // check for valid email (one @ etc.)
             if (!UserRegistrationUtil::isValidEmail($this->email)) {
                 throw new UserInputException('email', 'notValid');
             }
             // Check if email exists already.
             if (!UserUtil::isAvailableEmail($this->email)) {
                 throw new UserInputException('email', 'notUnique');
             }
         }
         // check confirm input
         if (StringUtil::toLowerCase($this->email) != StringUtil::toLowerCase($this->confirmEmail)) {
             throw new UserInputException('confirmEmail', 'notEqual');
         }
     }
 }
開發者ID:joaocustodio,項目名稱:EmuDevstore-1,代碼行數:63,代碼來源:AccountManagementForm.class.php

示例5: validateUsername

 /**
  * Validates the username.
  */
 protected function validateUsername()
 {
     // only for guests
     if (WCF::getUser()->userID == 0) {
         if (empty($this->username)) {
             throw new UserInputException('username');
         }
         if (!UserUtil::isValidUsername($this->username)) {
             throw new UserInputException('username', 'invalid');
         }
         if (!UserUtil::isAvailableUsername($this->username)) {
             throw new UserInputException('username', 'notUnique');
         }
         WCF::getSession()->register('username', $this->username);
     }
 }
開發者ID:Griborim,項目名稱:de.incendium.cms.linklist,代碼行數:19,代碼來源:EntryAddForm.class.php


注:本文中的UserUtil::isAvailableUsername方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。