You are here

protected function TfaTotp::storeAcceptedCode in TFA Basic plugins 7

Parameters

string $code:

1 call to TfaTotp::storeAcceptedCode()
TfaTotp::validateForm in includes/tfa_totp.inc
@copydoc TfaValidationPluginInterface::validateForm()

File

includes/tfa_totp.inc, line 108
classes for tfa_totp

Class

TfaTotp
Class TfaTotp

Code

protected function storeAcceptedCode($code) {
  $code = preg_replace('/\\s+/', '', $code);
  $hash = hash('sha1', drupal_get_hash_salt() . $code);
  db_insert('tfa_accepted_code')
    ->fields(array(
    'uid' => $this->context['uid'],
    'code_hash' => $hash,
    'time_accepted' => REQUEST_TIME,
  ))
    ->execute();
}