| @@ 128-150 (lines=23) @@ | ||
| 125 | * |
|
| 126 | * @return Palladium\Entity\EmailIdentity |
|
| 127 | */ |
|
| 128 | public function findEmailIdentityByToken(string $token, $action = Entity\Identity::ACTION_ANY) |
|
| 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 | /** |
|
| @@ 161-183 (lines=23) @@ | ||
| 158 | * |
|
| 159 | * @return Palladium\Entity\CookieIdentity |
|
| 160 | */ |
|
| 161 | public function findCookieIdentity($accountId, $series) |
|
| 162 | { |
|
| 163 | $cookie = new Entity\CookieIdentity; |
|
| 164 | $cookie->setStatus(Entity\Identity::STATUS_ACTIVE); |
|
| 165 | $cookie->setAccountId($accountId); |
|
| 166 | $cookie->setSeries($series); |
|
| 167 | ||
| 168 | $mapper = $this->mapperFactory->create(Mapper\CookieIdentity::class); |
|
| 169 | $mapper->fetch($cookie); |
|
| 170 | ||
| 171 | if ($cookie->getId() === null) { |
|
| 172 | $this->logger->notice('identity not found', [ |
|
| 173 | 'input' => [ |
|
| 174 | 'account' => $cookie->getAccountId(), |
|
| 175 | 'series' => $cookie->getSeries(), |
|
| 176 | ], |
|
| 177 | ]); |
|
| 178 | ||
| 179 | throw new IdentityNotFound; |
|
| 180 | } |
|
| 181 | ||
| 182 | return $cookie; |
|
| 183 | } |
|
| 184 | ||
| 185 | ||
| 186 | /** |
|