diff --git a/src/Appwrite/Migration/Version/V20.php b/src/Appwrite/Migration/Version/V20.php index 67ed21a03d..30592e7d6a 100644 --- a/src/Appwrite/Migration/Version/V20.php +++ b/src/Appwrite/Migration/Version/V20.php @@ -551,12 +551,11 @@ class V20 extends Migration $document->setAttribute('expire', $expire); $factors = match ($document->getAttribute('provider')) { - Auth::SESSION_PROVIDER_MAGIC_URL, - Auth::SESSION_PROVIDER_OAUTH2 => ['email'], + Auth::SESSION_PROVIDER_EMAIL => ['password'], Auth::SESSION_PROVIDER_PHONE => ['phone'], Auth::SESSION_PROVIDER_ANONYMOUS => ['anonymous'], Auth::SESSION_PROVIDER_TOKEN => ['token'], - default => ['password'], + default => ['email'], }; $document->setAttribute('factors', $factors); diff --git a/tests/unit/Utopia/Response/Filters/V17Test.php b/tests/unit/Utopia/Response/Filters/V17Test.php index 25f4fb2f2e..c9001b1d30 100644 --- a/tests/unit/Utopia/Response/Filters/V17Test.php +++ b/tests/unit/Utopia/Response/Filters/V17Test.php @@ -73,6 +73,8 @@ class V17Test extends TestCase 'remove targets' => [ [ 'targets' => 'test', + 'mfa' => 'test', + 'totp' => 'test', ], [ ], @@ -116,4 +118,71 @@ class V17Test extends TestCase $this->assertEquals($expected, $result); } + + public function membershipProvider(): array + { + return [ + 'remove mfa' => [ + [ + 'mfa' => 'test', + ], + [ + ], + ], + ]; + } + + /** + * @dataProvider membershipProvider + */ + public function testMembership(array $content, array $expected): void + { + $model = Response::MODEL_MEMBERSHIP; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function sessionProvider(): array + { + return [ + 'remove factors and secrets' => [ + [ + 'factors' => 'test', + 'secret' => 'test', + ], + [ + ], + ] + ]; + } + + /** + * @dataProvider sessionProvider + */ + public function testSession(array $content, array $expected): void + { + $model = Response::MODEL_SESSION; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function webhookProvider(): array + { + return [ + 'remove webhook additions' => [ + [ + 'enabled' => true, + 'logs' => ['test', 'test'], + 'attempts' => 1 + ], + [ + ], + ], + ]; + } + }