From 8a72a5ac9d4fb8898133c3ff620c543209d8b68d Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Sun, 20 Jul 2025 19:12:54 +0200 Subject: [PATCH] fixup! Add a two-step setup of OTP Signed-off-by: Kevin Decherf --- migrations/Version20250413133131.php | 3 +-- src/Entity/User.php | 3 --- tests/Controller/ConfigControllerTest.php | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/migrations/Version20250413133131.php b/migrations/Version20250413133131.php index ff6e1411a..cf77e87e3 100644 --- a/migrations/Version20250413133131.php +++ b/migrations/Version20250413133131.php @@ -8,11 +8,10 @@ use Doctrine\DBAL\Schema\Schema; use Wallabag\Doctrine\WallabagMigration; /** - * Add boolean for two-step setup for google authenticator + * Add boolean for two-step setup for google authenticator. */ final class Version20250413133131 extends WallabagMigration { - public function up(Schema $schema): void { $userTable = $schema->getTable($this->getTable('user')); diff --git a/src/Entity/User.php b/src/Entity/User.php index e8051c05a..f3668e787 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -269,9 +269,6 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI $this->emailTwoFactor = $emailTwoFactor; } - /** - * @param bool $googleAuthenticator - */ public function setGoogleAuthenticator(bool $googleAuthenticator): void { $this->googleAuthenticator = $googleAuthenticator; diff --git a/tests/Controller/ConfigControllerTest.php b/tests/Controller/ConfigControllerTest.php index e88131987..d0d557bc8 100644 --- a/tests/Controller/ConfigControllerTest.php +++ b/tests/Controller/ConfigControllerTest.php @@ -1231,9 +1231,9 @@ class ConfigControllerTest extends WallabagTestCase $googleAuthenticatorMock ->method('checkCode') ->willReturnCallback(function ($user, $code) { - return $code === '123456'; + return '123456' === $code; }); - + $this->logInAs('admin'); $client = $this->getTestClient(); $client->disableReboot(); // Disable reboot to keep the mock in the container @@ -1289,7 +1289,7 @@ class ConfigControllerTest extends WallabagTestCase ->findOneByUsername('admin'); $this->assertTrue($user->isGoogleTwoFactor()); - $this->assertGreaterThan(0, count($user->getBackupCodes())); + $this->assertGreaterThan(0, \count($user->getBackupCodes())); // Restore user $user->setGoogleAuthenticatorSecret(null);