$this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(['_text'])[0]);
}
- public function testLoginWith2Factor()
+ public function testLoginWith2FactorEmail()
{
$client = $this->getClient();
$user = $em
->getRepository('WallabagUserBundle:User')
->findOneByUsername('admin');
- $user->setTwoFactorAuthentication(true);
+ $user->setEmailTwoFactor(true);
$em->persist($user);
$em->flush();
$user = $em
->getRepository('WallabagUserBundle:User')
->findOneByUsername('admin');
- $user->setTwoFactorAuthentication(false);
+ $user->setEmailTwoFactor(false);
$em->persist($user);
$em->flush();
}
- public function testTrustedComputer()
+ public function testLoginWith2FactorGoogle()
{
$client = $this->getClient();
return;
}
+ $client->followRedirects();
+
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
$user = $em
->getRepository('WallabagUserBundle:User')
->findOneByUsername('admin');
+ $user->setGoogleAuthenticatorSecret('26LDIHYGHNELOQEM');
+ $em->persist($user);
+ $em->flush();
+
+ $this->logInAsUsingHttp('admin');
+ $crawler = $client->request('GET', '/config');
+ $this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(['_text'])[0]);
- $date = new \DateTime();
- $user->addTrustedComputer('ABCDEF', $date->add(new \DateInterval('P1M')));
- $this->assertTrue($user->isTrustedComputer('ABCDEF'));
- $this->assertFalse($user->isTrustedComputer('FEDCBA'));
+ // restore user
+ $user = $em
+ ->getRepository('WallabagUserBundle:User')
+ ->findOneByUsername('admin');
+ $user->setGoogleAuthenticatorSecret(null);
+ $em->persist($user);
+ $em->flush();
}
public function testEnabledRegistration()