Ejemplo n.º 1
0
 public function format(Account $account, array $frontline)
 {
     $profiles = array_map(function (Profile $profile) {
         return $this->profileFormatter->format($profile);
     }, $account->getProfiles()->toArray());
     return ["api_key" => $account->getAPIKey(), "account" => $account->toJSON(), "profiles" => $profiles, "frontline" => $frontline];
 }
Ejemplo n.º 2
0
 public function createAccount($email, $password = null) : Account
 {
     $account = new Account();
     $account->setEmail($email)->setPassword($this->passwordVerifyService->generatePassword($password));
     while ($this->checkAPIKeyCollision($account->getAPIKey())) {
         $account->regenerateAPIKey();
     }
     $this->accountRepository->createAccount($account);
     $this->getEventEmitter()->emit(self::EVENT_ACCOUNT_CREATED, [$account]);
     $this->profileService->createProfileForAccount($account);
     $this->accountRepository->saveAccount($account);
     return $account;
 }
Ejemplo n.º 3
0
 public function auth(Account $account) : Account
 {
     $_SESSION[SessionStrategy::SESSION_API_KEY] = $account->getAPIKey();
     $this->currentAccountService->signInWithAccount($account);
     return $account;
 }