Added possibility to show backup codes in user settings.

This commit is contained in:
Jan Böhmer 2019-12-27 18:21:12 +01:00
parent fba5f9794f
commit 604ebe420d
13 changed files with 288 additions and 6 deletions

View file

@ -57,13 +57,16 @@ class UserTest extends TestCase
$this->assertSame($expected ,$user->isGoogleAuthenticatorEnabled());
}
/**
* @requires PHPUnit 8
*/
public function testSetBackupCodes()
{
$user = new User();
$codes = ["test", "invalid", "test"];
$user->setBackupCodes($codes);
// Backup Codes generation date must be changed!
$this->assertEquals(new \DateTime(), $user->getBackupCodesGenerationDate(), '', 0.1);
$this->assertEqualsWithDelta(new \DateTime(), $user->getBackupCodesGenerationDate(), 0.1);
$this->assertEquals($codes, $user->getBackupCodes());
//Test what happens if we delete the backup keys