Esempio n. 1
0
 protected function _beforeAdd()
 {
     if (!$this->dm) {
         return new PwError('USER:user.info.error');
     }
     if (($result = PwUserValidator::isUsernameHasIllegalChar($this->getField('username'))) !== false) {
         return $result;
     }
     if (($result = PwUserValidator::isPwdValid($this->_password, $this->getField('username'))) !== true) {
         return $result;
     }
     if (($result = $this->dm->beforeAdd()) !== true) {
         $errorCode = $result->getCode();
         $var = array();
         if ($errorCode == -2) {
             $windid = WindidApi::api('config');
             $config = $windid->getConfig('reg');
             $var = array('{min}' => $config['namelength.min'], '{max}' => $config['namelength.max']);
         }
         if ($errorCode == -11) {
             $windid = WindidApi::api('config');
             $config = $windid->getConfig('reg');
             $var = array('{min}' => $config['passwordlength.min'], '{max}' => $config['passwordlength.max']);
         }
         return new PwError('WINDID:code.' . $errorCode, $var);
     }
     if (true !== ($result = $this->check())) {
         return $result;
     }
     return true;
 }
Esempio n. 2
0
 protected function _beforeAdd()
 {
     if (!$this->dm) {
         return new PwError('USER:user.info.error');
     }
     if (($result = PwUserValidator::isUsernameHasIllegalChar($this->getField('username'))) !== false) {
         return $result;
     }
     if (($result = PwUserValidator::isPwdValid($this->_password, $this->getField('username'))) !== true) {
         return $result;
     }
     if (WINDID_CONNECT == 'db' && ($result = $this->dm->beforeAdd()) !== true) {
         return $this->_getWindidMsg($result);
     }
     if (true !== ($result = $this->check())) {
         return $result;
     }
     return true;
 }