| @@ 126-143 (lines=18) @@ | ||
| 123 | return $stmt->fetch(PDO::FETCH_ASSOC); |
|
| 124 | } |
|
| 125 | ||
| 126 | public function getVootToken($userId) |
|
| 127 | { |
|
| 128 | $userId = $this->getId($userId); |
|
| 129 | $stmt = $this->db->prepare( |
|
| 130 | <<< 'SQL' |
|
| 131 | SELECT |
|
| 132 | voot_token |
|
| 133 | FROM |
|
| 134 | voot_tokens |
|
| 135 | WHERE |
|
| 136 | user_id = :user_id |
|
| 137 | SQL |
|
| 138 | ); |
|
| 139 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_INT); |
|
| 140 | $stmt->execute(); |
|
| 141 | ||
| 142 | return $stmt->fetchColumn(); |
|
| 143 | } |
|
| 144 | ||
| 145 | public function setVootToken($userId, $vootToken) |
|
| 146 | { |
|
| @@ 221-238 (lines=18) @@ | ||
| 218 | return 1 === (int) $stmt->fetchColumn(); |
|
| 219 | } |
|
| 220 | ||
| 221 | public function getTotpSecret($userId) |
|
| 222 | { |
|
| 223 | $userId = $this->getId($userId); |
|
| 224 | $stmt = $this->db->prepare( |
|
| 225 | <<< 'SQL' |
|
| 226 | SELECT |
|
| 227 | totp_secret |
|
| 228 | FROM |
|
| 229 | totp_secrets |
|
| 230 | WHERE |
|
| 231 | user_id = :user_id |
|
| 232 | SQL |
|
| 233 | ); |
|
| 234 | $stmt->bindValue(':user_id', $userId, PDO::PARAM_INT); |
|
| 235 | $stmt->execute(); |
|
| 236 | ||
| 237 | return $stmt->fetchColumn(); |
|
| 238 | } |
|
| 239 | ||
| 240 | public function setTotpSecret($userId, $totpSecret) |
|
| 241 | { |
|
| @@ 690-702 (lines=13) @@ | ||
| 687 | return $stmt->fetchColumn(); |
|
| 688 | } |
|
| 689 | ||
| 690 | public function setMotd($motdMessage) |
|
| 691 | { |
|
| 692 | $this->deleteMotd(); |
|
| 693 | ||
| 694 | $stmt = $this->db->prepare( |
|
| 695 | <<< 'SQL' |
|
| 696 | INSERT INTO motd |
|
| 697 | (motd_message) |
|
| 698 | VALUES |
|
| 699 | (:motd_message) |
|
| 700 | SQL |
|
| 701 | ); |
|
| 702 | ||
| 703 | $stmt->bindValue(':motd_message', $motdMessage, PDO::PARAM_STR); |
|
| 704 | $stmt->execute(); |
|
| 705 | ||