Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 856bf80

Browse files
authored
minor #12093 Use sha512 to encode passwords in test environments (pamil)
This PR was merged into the 1.8 branch. Discussion ---------- See #11599. Commits ------- ef48101 Use sha512 to encode passwords in test environments
2 parents f8b3371 + ef48101 commit 856bf80

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

config/packages/test/security.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
security:
22
encoders:
33
sha512: sha512
4+
Sylius\Component\User\Model\UserInterface: sha512
5+
6+
sylius_user:
7+
encoder: sha512
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
security:
22
encoders:
33
sha512: sha512
4+
Sylius\Component\User\Model\UserInterface: sha512
5+
6+
sylius_user:
7+
encoder: sha512

tests/Functional/UpdatingUserPasswordEncoderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function it_updates_the_encoder_when_the_shop_user_logs_in(): void
5959

6060
$shopUser = $shopUserRepository->findOneByEmail('[email protected]');
6161
$shopUser->setPlainPassword('testpassword');
62-
$shopUser->setEncoderName('sha512');
62+
$shopUser->setEncoderName('argon2i');
6363

6464
$shopUserManager->persist($shopUser);
6565
$shopUserManager->flush();
@@ -73,7 +73,7 @@ public function it_updates_the_encoder_when_the_shop_user_logs_in(): void
7373

7474
Assert::assertSame(200, $this->client->getResponse()->getStatusCode());
7575
Assert::assertSame('/en_US/', parse_url($this->client->getCrawler()->getUri(), \PHP_URL_PATH));
76-
Assert::assertSame('argon2i', $shopUserRepository->findOneByEmail('[email protected]')->getEncoderName());
76+
Assert::assertSame('sha512', $shopUserRepository->findOneByEmail('[email protected]')->getEncoderName());
7777
}
7878

7979
/** @test */
@@ -87,7 +87,7 @@ public function it_updates_the_encoder_when_the_admin_user_logs_in(): void
8787

8888
$adminUser = $adminUserRepository->findOneByEmail('[email protected]');
8989
$adminUser->setPlainPassword('testpassword');
90-
$adminUser->setEncoderName('sha512');
90+
$adminUser->setEncoderName('argon2i');
9191

9292
$adminUserManager->persist($adminUser);
9393
$adminUserManager->flush();
@@ -101,7 +101,7 @@ public function it_updates_the_encoder_when_the_admin_user_logs_in(): void
101101

102102
Assert::assertSame(200, $this->client->getResponse()->getStatusCode());
103103
Assert::assertSame('/admin/', parse_url($this->client->getCrawler()->getUri(), \PHP_URL_PATH));
104-
Assert::assertSame('argon2i', $adminUserRepository->findOneByEmail('[email protected]')->getEncoderName());
104+
Assert::assertSame('sha512', $adminUserRepository->findOneByEmail('[email protected]')->getEncoderName());
105105
}
106106

107107
/** @test */

0 commit comments

Comments
 (0)