| @@ 90-111 (lines=22) @@ | ||
| 87 | } |
|
| 88 | ||
| 89 | ||
| 90 | private function updateCookie(Entity\CookieIdentity $entity) |
|
| 91 | { |
|
| 92 | $active = Entity\Identity::STATUS_ACTIVE; |
|
| 93 | ||
| 94 | $sql = "UPDATE {$this->table} |
|
| 95 | SET status = :status, |
|
| 96 | hash = :hash, |
|
| 97 | used_on = :used, |
|
| 98 | expires_on = :expires |
|
| 99 | WHERE identity_id = :id |
|
| 100 | AND status = {$active}"; |
|
| 101 | ||
| 102 | $statement = $this->connection->prepare($sql); |
|
| 103 | ||
| 104 | $statement->bindValue(':id', $entity->getId()); |
|
| 105 | $statement->bindValue(':status', $entity->getStatus()); |
|
| 106 | $statement->bindValue(':hash', $entity->getHash()); |
|
| 107 | $statement->bindValue(':expires', $entity->getExpiresOn()); |
|
| 108 | $statement->bindValue(':used', $entity->getLastUsed()); |
|
| 109 | ||
| 110 | $statement->execute(); |
|
| 111 | } |
|
| 112 | } |
|
| 113 | ||
| @@ 154-177 (lines=24) @@ | ||
| 151 | } |
|
| 152 | ||
| 153 | ||
| 154 | private function updateIdentity(Entity\EmailIdentity $entity) |
|
| 155 | { |
|
| 156 | $sql = "UPDATE {$this->table} |
|
| 157 | SET hash = :hash, |
|
| 158 | status = :status, |
|
| 159 | used_on = :used, |
|
| 160 | expires_on = :expires, |
|
| 161 | token = :token, |
|
| 162 | token_action = :action, |
|
| 163 | token_expires_on = :token_eol |
|
| 164 | WHERE identity_id = :id"; |
|
| 165 | ||
| 166 | $statement = $this->connection->prepare($sql); |
|
| 167 | ||
| 168 | $statement->bindValue(':id', $entity->getId()); |
|
| 169 | $statement->bindValue(':hash', $entity->getHash()); |
|
| 170 | $statement->bindValue(':status', $entity->getStatus()); |
|
| 171 | $statement->bindValue(':used', $entity->getLastUsed()); |
|
| 172 | $statement->bindValue(':expires', $entity->getExpiresOn()); |
|
| 173 | ||
| 174 | $this->bindToken($statement, $entity); |
|
| 175 | ||
| 176 | $statement->execute(); |
|
| 177 | } |
|
| 178 | ||
| 179 | ||
| 180 | private function bindToken(PDOStatement $statement, Entity\EmailIdentity $entity) |
|