/** * Check if code given is the same generated by secret * @param string $code * @return bool return true if the code is the same */ public function check($code) { return $this->googleAuthenticator->checkCode($this->secret, $code); }
/** * @param UserInterface $user * @param $code * * @return bool */ public function checkCode(UserInterface $user, $code) { return $this->authenticator->checkCode($user->getTwoStepVerificationCode(), $code); }
/** * Validates the code, which was entered by the user. * * @param TwoFactorInterface $user * @param string $code * * @return bool */ public function checkCode(TwoFactorInterface $user, $code) { return $this->authenticator->checkCode($user->getGoogleAuthenticatorSecret(), $code); }
public function testGetCode() { $code = $this->helper->getCode('3DHTQX4GCRKHGS55CJ', strtotime('17/03/2012 22:17')); $this->assertTrue($this->helper->checkCode('3DHTQX4GCRKHGS55CJ', $code)); }