@@ 191-204 (lines=14) @@ | ||
188 | { |
|
189 | continue; |
|
190 | } |
|
191 | if ($this->password_manager->check($key, $registration['secret'])) |
|
192 | { |
|
193 | // We found a valid key. |
|
194 | $sql_ary = array( |
|
195 | 'last_used' => time(), |
|
196 | 'valid' => false, |
|
197 | ); |
|
198 | $sql = 'UPDATE ' . $this->backup_registration_table . ' |
|
199 | SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
200 | WHERE |
|
201 | registration_id = ' . (int) $registration['registration_id']; |
|
202 | $this->db->sql_query($sql); |
|
203 | return true; |
|
204 | } |
|
205 | } |
|
206 | return false; |
|
207 | } |
@@ 187-199 (lines=13) @@ | ||
184 | ||
185 | foreach ($this->getRegistrations($user_id) as $registration) |
|
186 | { |
|
187 | if ($this->otp->checkTOTP($registration['secret'], $key, 'sha1')) |
|
188 | { |
|
189 | // We found a valid key. |
|
190 | $sql_ary = array( |
|
191 | 'last_used' => time(), |
|
192 | ); |
|
193 | $sql = 'UPDATE ' . $this->otp_registration_table . ' |
|
194 | SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' |
|
195 | WHERE |
|
196 | registration_id = ' . (int) $registration['registration_id']; |
|
197 | $this->db->sql_query($sql); |
|
198 | return true; |
|
199 | } |
|
200 | } |
|
201 | return false; |
|
202 | } |