You are here

protected function TfaTotp::validate in TFA Basic plugins 7

@copydoc TfaBasePlugin::validate()

Overrides TfaBasePlugin::validate

1 call to TfaTotp::validate()
TfaTotp::validateForm in includes/tfa_totp.inc
@copydoc TfaValidationPluginInterface::validateForm()
1 method overrides TfaTotp::validate()
TfaTotpSetup::validate in includes/tfa_totp.inc
@copydoc TfaBasePlugin::validate()

File

includes/tfa_totp.inc, line 91
classes for tfa_totp

Class

TfaTotp
Class TfaTotp

Code

protected function validate($code) {

  // Strip whitespace.
  $code = preg_replace('/\\s+/', '', $code);
  if ($this
    ->alreadyAcceptedCode($code)) {
    $this->isValid = FALSE;
  }
  else {

    // Get OTP seed.
    $seed = $this
      ->getSeed();
    $this->isValid = $seed && $this->ga
      ->verifyCode($seed, $code, $this->timeSkew);
  }
  return $this->isValid;
}