function check() { /** @var usersModel */ $model = APP::getInstance('UsersModel'); # Tipo de conta if (!$model->getType($this->getType())) { throw new Exception('Tipo inválido.'); } # E-mail if ($this->Email and !$this->getEmail()) { throw new Exception('E-mail inválido.'); } else { if ($this->getEmail() and count($model->Lista('WHERE a.email = :email AND a.id != :id LIMIT 1', ['email' => $this->getEmail(), 'id' => $this->getId()]))) { throw new Exception('E-mail já está sendo utilizado por outro usuário.'); } } # Login if (is_string($teste = VALIDAR::username($this->Login))) { throw new Exception(strip_tags($teste)); } # Criptografando a senha if (strlen($this->Senha) != PASSWORD_LENG) { if (is_string($teste = VALIDAR::password($this->Senha))) { throw new Exception(strip_tags($teste)); } $this->Senha = password($this->Senha); } return true; }