| @@ 120-132 (lines=13) @@ | ||
| 117 | return 1 === $stmt->rowCount(); |
|
| 118 | } |
|
| 119 | ||
| 120 | public function hasVootToken($externalUserId) |
|
| 121 | { |
|
| 122 | $userId = $this->getUserId($externalUserId); |
|
| 123 | $stmt = $this->db->prepare( |
|
| 124 | 'SELECT COUNT(*) |
|
| 125 | FROM voot_tokens |
|
| 126 | WHERE user_id = :user_id' |
|
| 127 | ); |
|
| 128 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 129 | $stmt->execute(); |
|
| 130 | ||
| 131 | return 1 === intval($stmt->fetchColumn()); |
|
| 132 | } |
|
| 133 | ||
| 134 | public function deleteVootToken($externalUserId) |
|
| 135 | { |
|
| @@ 134-145 (lines=12) @@ | ||
| 131 | return 1 === intval($stmt->fetchColumn()); |
|
| 132 | } |
|
| 133 | ||
| 134 | public function deleteVootToken($externalUserId) |
|
| 135 | { |
|
| 136 | $userId = $this->getUserId($externalUserId); |
|
| 137 | $stmt = $this->db->prepare( |
|
| 138 | 'DELETE FROM voot_tokens WHERE user_id = :user_id' |
|
| 139 | ); |
|
| 140 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 141 | ||
| 142 | $stmt->execute(); |
|
| 143 | ||
| 144 | return 1 === $stmt->rowCount(); |
|
| 145 | } |
|
| 146 | ||
| 147 | public function hasTotpSecret($externalUserId) |
|
| 148 | { |
|
| @@ 147-159 (lines=13) @@ | ||
| 144 | return 1 === $stmt->rowCount(); |
|
| 145 | } |
|
| 146 | ||
| 147 | public function hasTotpSecret($externalUserId) |
|
| 148 | { |
|
| 149 | $userId = $this->getUserId($externalUserId); |
|
| 150 | $stmt = $this->db->prepare( |
|
| 151 | 'SELECT COUNT(*) |
|
| 152 | FROM totp_secrets |
|
| 153 | WHERE user_id = :user_id' |
|
| 154 | ); |
|
| 155 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 156 | $stmt->execute(); |
|
| 157 | ||
| 158 | return 1 === intval($stmt->fetchColumn()); |
|
| 159 | } |
|
| 160 | ||
| 161 | public function getTotpSecret($externalUserId) |
|
| 162 | { |
|
| @@ 189-200 (lines=12) @@ | ||
| 186 | return 1 === $stmt->rowCount(); |
|
| 187 | } |
|
| 188 | ||
| 189 | public function deleteTotpSecret($externalUserId) |
|
| 190 | { |
|
| 191 | $userId = $this->getUserId($externalUserId); |
|
| 192 | $stmt = $this->db->prepare( |
|
| 193 | 'DELETE FROM totp_secrets WHERE user_id = :user_id' |
|
| 194 | ); |
|
| 195 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_STR); |
|
| 196 | ||
| 197 | $stmt->execute(); |
|
| 198 | ||
| 199 | return 1 === $stmt->rowCount(); |
|
| 200 | } |
|
| 201 | ||
| 202 | public function deleteUser($externalUserId) |
|
| 203 | { |
|
| @@ 308-319 (lines=12) @@ | ||
| 305 | return 1 === $stmt->rowCount(); |
|
| 306 | } |
|
| 307 | ||
| 308 | public function isDisabledUser($externalUserId) |
|
| 309 | { |
|
| 310 | $stmt = $this->db->prepare( |
|
| 311 | 'SELECT COUNT(*) |
|
| 312 | FROM users |
|
| 313 | WHERE external_user_id = :external_user_id AND is_disabled = 1' |
|
| 314 | ); |
|
| 315 | $stmt->bindValue(':external_user_id', $externalUserId, PDO::PARAM_STR); |
|
| 316 | $stmt->execute(); |
|
| 317 | ||
| 318 | return 1 === intval($stmt->fetchColumn()); |
|
| 319 | } |
|
| 320 | ||
| 321 | public function clientConnect($profileId, $commonName, $ip4, $ip6, $connectedAt) |
|
| 322 | { |
|
| @@ 461-473 (lines=13) @@ | ||
| 458 | return $stmt->fetchColumn(); |
|
| 459 | } |
|
| 460 | ||
| 461 | public function setMotd($motdMessage) |
|
| 462 | { |
|
| 463 | $this->deleteMotd(); |
|
| 464 | ||
| 465 | $stmt = $this->db->prepare( |
|
| 466 | 'INSERT INTO motd (motd_message) VALUES(:motd_message)' |
|
| 467 | ); |
|
| 468 | ||
| 469 | $stmt->bindValue(':motd_message', $motdMessage, PDO::PARAM_STR); |
|
| 470 | $stmt->execute(); |
|
| 471 | ||
| 472 | return 1 === $stmt->rowCount(); |
|
| 473 | } |
|
| 474 | ||
| 475 | public function deleteMotd() |
|
| 476 | { |
|