Code Duplication    Length = 13-14 lines in 2 locations

modules/backup_key.php 1 location

@@ 178-191 (lines=14) @@
175
			{
176
				continue;
177
			}
178
			if ($this->password_manager->check($key, $registration['secret']))
179
			{
180
				// We found a valid key.
181
				$sql_ary = array(
182
					'last_used' => time(),
183
					'valid'		=> false,
184
				);
185
				$sql = 'UPDATE ' . $this->backup_registration_table . ' 
186
							SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' 
187
							WHERE 
188
								registration_id = ' . (int) $registration['registration_id'];
189
				$this->db->sql_query($sql);
190
				return true;
191
			}
192
		}
193
		return false;
194
	}

modules/otp.php 1 location

@@ 174-186 (lines=13) @@
171
172
		foreach ($this->getRegistrations($user_id) as $registration)
173
		{
174
			if ($this->otp->checkTOTP($registration['secret'], $key, 'sha1'))
175
			{
176
				// We found a valid key.
177
				$sql_ary = array(
178
					'last_used' => time(),
179
				);
180
				$sql = 'UPDATE ' . $this->otp_registration_table . ' 
181
							SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' 
182
							WHERE 
183
								registration_id = ' . (int) $registration['registration_id'];
184
				$this->db->sql_query($sql);
185
				return true;
186
			}
187
		}
188
		return false;
189
	}