public function account()
 {
     $model = new User();
     $error = $model->setAccount();
     if ($error) {
         $text = '';
         foreach ($error as $key => $item) {
             $text .= 'error[' . $key . ']=' . $item . '&';
         }
         $this->redirect('/registration/email/?' . $text);
     } else {
         $this->redirect('/registration/finish/');
     }
 }
Example #2
0
 /**
  * @param	User $user The user object to add.
  */
 protected function doAddUser($user)
 {
     $this->collUsers[] = $user;
     $user->setAccount($this);
 }
Example #3
0
 private function importUsers(Status $logger, Account $account, Domain $domain, PDO $source, PropelPDO $dest)
 {
     $statement = $source->query('SELECT * FROM platform_users');
     $rows = $statement->fetchAll(PDO::FETCH_ASSOC);
     $statement->closeCursor();
     $statement = null;
     if (!is_array($rows)) {
         throw new Exception('Could not fetch users');
     }
     if (!$dest->beginTransaction()) {
         throw new Exception('Could not start transaction.');
     }
     try {
         foreach ($rows as $row) {
             $user = new User();
             $user->setAccount($account)->setDomain($domain)->setName($row['username'])->setEmail($row['email'])->lockPassword()->save($dest);
         }
     } catch (Exception $e) {
         $dest->rollBack();
         throw $e;
     }
     if (!$dest->commit()) {
         throw new Exception('Could not commit transaction.');
     }
 }
Example #4
0
 /**
  * Gets User Info
  *
  * @param email - required -
  *            The email address of the user for which information is requested.
  * @return The User object. If the operation was successful, the object contains the user info, if not, the object
  * 			contains the error code and message.
  */
 public function getUserInfo($email)
 {
     $parameters = array('email' => $email);
     $urld = 'dpi/v2/user';
     $this->response = $this->restTransportInstance->sendRequest($urld, $parameters, self::HTTP_GET, $this->authToken);
     $responseBody = simplexml_load_string($this->response);
     $returnObject = new User();
     if ($responseBody === false) {
         $errorCode = 'N/A';
         $errorMessage = 'The server has encountered an error, please try again.';
         $errorObject = new ErrorStatus($errorCode, $errorMessage);
         $returnObject->setErrorStatus($errorObject);
     } else {
         $errorStatus = $responseBody->errorStatus;
         if (empty($errorStatus)) {
             $returnObject->setEmail((string) $responseBody->email);
             $returnObject->setFirstName((string) $responseBody->firstname);
             $returnObject->setLastName((string) $responseBody->lastname);
             $returnObject->setType((string) $responseBody->type);
             $returnObject->setVersion((string) $responseBody->version);
             $account = new Account((string) $responseBody->account->maxFileSize, (string) $responseBody->account->maxFileDownloads, (string) $responseBody->account->verifyRecipientIdentity, (string) $responseBody->account->maxDownloadBWpermonth, (string) $responseBody->account->availableStorage, (string) $responseBody->account->knowledgeBase, (string) $responseBody->account->returnReceipt, (string) $responseBody->account->passwordProtect, (string) $responseBody->account->controlExpirationDate);
             $returnObject->setAccount($account);
             $storage = new Storage((string) $responseBody->storage->attributes()->revision, (string) $responseBody->storage->attributes()->id, (string) $responseBody->storage->currentUsage, (string) $responseBody->storage->storageQuota);
             $returnObject->setStorage($storage);
         } else {
             $errorCode = (string) $responseBody->errorStatus->code;
             $errorMessage = (string) $responseBody->errorStatus->message;
             $errorObject = new ErrorStatus($errorCode, $errorMessage);
             $returnObject->setErrorStatus($errorObject);
         }
     }
     return $returnObject;
 }