Beispiel #1
0
 public function validate()
 {
     if ($this->max_rows_list > 250) {
         $this->setValidationError('max_rows_list', GO::t('maxRowslistTooHigh'));
     }
     if ($this->isModified('password') && isset($this->passwordConfirm) && $this->passwordConfirm != $this->password) {
         $this->setValidationError('passwordConfirm', GO::t('passwordMatchError'));
     }
     if ($this->isModified('disk_quota') && !GO::$ignoreAclPermissions && GO::user()->getModulePermissionLevel('users') < Acl::MANAGE_PERMISSION) {
         $this->setValidationError('disk_quota', 'Only managers of the "users"  module may modify disk quota');
     }
     if (GO::config()->password_validate && $this->isModified('password')) {
         if (!\GO\Base\Util\Validate::strongPassword($this->password)) {
             $this->setValidationError('password', \GO\Base\Util\Validate::getPasswordErrorString($this->password));
         }
     }
     if ($this->isNew && $this->_maxUsersReached()) {
         $this->setValidationError('form', GO::t('max_users_reached', 'users'));
     }
     if (!GO::config()->allow_duplicate_email) {
         $existing = $this->findSingleByAttribute('email', $this->email);
         if ($this->isNew && $existing || $existing && $existing->id != $this->id) {
             $this->setValidationError('email', GO::t('error_email_exists', 'users'));
         }
     }
     $existing = $this->findSingleByAttribute('username', $this->username);
     if ($this->isNew && $existing || $existing && $existing->id != $this->id) {
         $this->setValidationError('username', GO::t('error_username_exists', 'users'));
     }
     if (empty($this->password) && $this->isNew) {
         $this->password = \GO\Base\Util\String::randomPassword();
         $this->generatedRandomPassword = true;
     }
     return parent::validate();
 }