| @@ 103-125 (lines=23) @@ | ||
| 100 | * |
|
| 101 | * @return Palladium\Entity\EmailIdentity |
|
| 102 | */ |
|
| 103 | public function findEmailIdentityByToken(string $token, $action = Entity\Identity::ACTION_ANY) |
|
| 104 | { |
|
| 105 | $identity = new Entity\EmailIdentity; |
|
| 106 | ||
| 107 | $identity->setToken($token); |
|
| 108 | $identity->setTokenAction($action); |
|
| 109 | $identity->setTokenEndOfLife(time()); |
|
| 110 | ||
| 111 | $mapper = $this->mapperFactory->create(Mapper\Identity::class); |
|
| 112 | $mapper->fetch($identity); |
|
| 113 | ||
| 114 | if ($identity->getId() === null) { |
|
| 115 | $this->logger->notice('identity not found', [ |
|
| 116 | 'input' => [ |
|
| 117 | 'token' => $token, |
|
| 118 | ], |
|
| 119 | ]); |
|
| 120 | ||
| 121 | throw new IdentityNotFound; |
|
| 122 | } |
|
| 123 | ||
| 124 | return $identity; |
|
| 125 | } |
|
| 126 | ||
| 127 | ||
| 128 | /** |
|
| @@ 136-158 (lines=23) @@ | ||
| 133 | * |
|
| 134 | * @return Palladium\Entity\CookieIdentity |
|
| 135 | */ |
|
| 136 | public function findCookieIdentity($accountId, $series) |
|
| 137 | { |
|
| 138 | $cookie = new Entity\CookieIdentity; |
|
| 139 | $cookie->setStatus(Entity\Identity::STATUS_ACTIVE); |
|
| 140 | $cookie->setAccountId($accountId); |
|
| 141 | $cookie->setSeries($series); |
|
| 142 | ||
| 143 | $mapper = $this->mapperFactory->create(Mapper\CookieIdentity::class); |
|
| 144 | $mapper->fetch($cookie); |
|
| 145 | ||
| 146 | if ($cookie->getId() === null) { |
|
| 147 | $this->logger->notice('identity not found', [ |
|
| 148 | 'input' => [ |
|
| 149 | 'account' => $cookie->getAccountId(), |
|
| 150 | 'series' => $cookie->getSeries(), |
|
| 151 | ], |
|
| 152 | ]); |
|
| 153 | ||
| 154 | throw new IdentityNotFound; |
|
| 155 | } |
|
| 156 | ||
| 157 | return $cookie; |
|
| 158 | } |
|
| 159 | ||
| 160 | ||
| 161 | /** |
|