1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Added a button to disable 2FA when enabled

This commit is contained in:
Nicolas Lœuillet 2020-04-13 16:59:02 +02:00
parent 365b3dd21f
commit 4ff1efa418
No known key found for this signature in database
GPG key ID: 3A8718BE51C3BA8E
20 changed files with 122 additions and 4 deletions

View file

@ -1045,6 +1045,29 @@ class ConfigControllerTest extends WallabagCoreTestCase
$em->flush();
}
public function testUserDisable2faEmail()
{
$this->logInAs('admin');
$client = $this->getClient();
$crawler = $client->request('GET', '/config/otp/email/disable');
$this->assertSame(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.config.notice.otp_disabled', $alert[0]);
// restore user
$em = $this->getEntityManager();
$user = $em
->getRepository('WallabagUserBundle:User')
->findOneByUsername('admin');
$this->assertFalse($user->isEmailTwoFactor());
}
public function testUserEnable2faGoogle()
{
$this->logInAs('admin');
@ -1099,6 +1122,30 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertEmpty($user->getBackupCodes());
}
public function testUserDisable2faGoogle()
{
$this->logInAs('admin');
$client = $this->getClient();
$crawler = $client->request('GET', '/config/otp/app/disable');
$this->assertSame(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.config.notice.otp_disabled', $alert[0]);
// restore user
$em = $this->getEntityManager();
$user = $em
->getRepository('WallabagUserBundle:User')
->findOneByUsername('admin');
$this->assertEmpty($user->getGoogleAuthenticatorSecret());
$this->assertEmpty($user->getBackupCodes());
}
public function testExportTaggingRule()
{
$this->logInAs('admin');