| @@ 128-150 (lines=23) @@ | ||
| 125 | * |
|
| 126 | * @return Palladium\Entity\EmailIdentity |
|
| 127 | */ |
|
| 128 | public function findEmailIdentityByToken(string $token, $action = Entity\Identity::ACTION_NONE) |
|
| 129 | { |
|
| 130 | $identity = new Entity\EmailIdentity; |
|
| 131 | ||
| 132 | $identity->setToken($token); |
|
| 133 | $identity->setTokenAction($action); |
|
| 134 | $identity->setTokenEndOfLife(time()); |
|
| 135 | ||
| 136 | $mapper = $this->mapperFactory->create(Mapper\Identity::class); |
|
| 137 | $mapper->fetch($identity); |
|
| 138 | ||
| 139 | if ($identity->getId() === null) { |
|
| 140 | $this->logger->notice('identity not found', [ |
|
| 141 | 'input' => [ |
|
| 142 | 'token' => $token, |
|
| 143 | ], |
|
| 144 | ]); |
|
| 145 | ||
| 146 | throw new IdentityNotFound; |
|
| 147 | } |
|
| 148 | ||
| 149 | return $identity; |
|
| 150 | } |
|
| 151 | ||
| 152 | ||
| 153 | /** |
|
| @@ 190-212 (lines=23) @@ | ||
| 187 | * |
|
| 188 | * @return Palladium\Entity\CookieIdentity |
|
| 189 | */ |
|
| 190 | public function findCookieIdentity($accountId, $series) |
|
| 191 | { |
|
| 192 | $cookie = new Entity\CookieIdentity; |
|
| 193 | $cookie->setStatus(Entity\Identity::STATUS_ACTIVE); |
|
| 194 | $cookie->setAccountId($accountId); |
|
| 195 | $cookie->setSeries($series); |
|
| 196 | ||
| 197 | $mapper = $this->mapperFactory->create(Mapper\CookieIdentity::class); |
|
| 198 | $mapper->fetch($cookie); |
|
| 199 | ||
| 200 | if ($cookie->getId() === null) { |
|
| 201 | $this->logger->notice('identity not found', [ |
|
| 202 | 'input' => [ |
|
| 203 | 'account' => $cookie->getAccountId(), |
|
| 204 | 'series' => $cookie->getSeries(), |
|
| 205 | ], |
|
| 206 | ]); |
|
| 207 | ||
| 208 | throw new IdentityNotFound; |
|
| 209 | } |
|
| 210 | ||
| 211 | return $cookie; |
|
| 212 | } |
|
| 213 | ||
| 214 | ||
| 215 | /** |
|