Skip to content

Commit f511090

Browse files
committed
only upgrading password if user has password
1 parent 527925d commit f511090

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Maker/MakeUser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ class_exists(DoctrineBundle::class)
108108
$userWillHavePassword = $io->confirm('Does this app need to hash/check user passwords?');
109109
$input->setOption('with-password', $userWillHavePassword);
110110

111-
$useArgon2Encoder = false;
112111
if ($userWillHavePassword && !class_exists(NativePasswordEncoder::class) && Argon2iPasswordEncoder::isSupported()) {
113112
$io->writeln('The newer <comment>Argon2i</comment> password hasher requires PHP 7.2, libsodium or paragonie/sodium_compat. Your system DOES support this algorithm.');
114113
$io->writeln('You should use <comment>Argon2i</comment> unless your production system will not support it.');
@@ -140,7 +139,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
140139
$classPath = $entityClassGenerator->generateEntityClass(
141140
$userClassNameDetails,
142141
false, // api resource
143-
interface_exists(PasswordUpgraderInterface::class) // security user
142+
$userClassConfiguration->hasPassword() && interface_exists(PasswordUpgraderInterface::class) // security user
144143
);
145144
} else {
146145
$classPath = $generator->generateClass($userClassNameDetails->getFullName(), 'Class.tpl.php');

src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public function checkCredentials($credentials, UserInterface $user)
8787
}
8888

8989
<?php if ($password_authenticated): ?>
90+
/**
91+
* Used to upgrade (rehash) the user's password automatically over time.
92+
*/
9093
public function getPassword($credentials)
9194
{
9295
return $credentials['password'];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy