@@ -13,14 +13,14 @@ class <?= $class_name; ?> extends AbstractFormLoginAuthenticator<?= $password_au
13
13
<?= $ user_is_entity ? " private \$entityManager; \n" : null ?>
14
14
private $urlGenerator;
15
15
private $csrfTokenManager;
16
- <?= $ user_needs_encoder ? " private \$ passwordEncoder ; \n" : null ?>
16
+ <?= $ user_needs_encoder ? sprintf ( " private %s$%s ; \n" , $ generator -> getPropertyType ( $ password_class_details ), $ password_variable_name ) : null ?>
17
17
18
- public function __construct(<?= $ user_is_entity ? 'EntityManagerInterface $entityManager, ' : null ?> UrlGeneratorInterface $urlGenerator, CsrfTokenManagerInterface $csrfTokenManager<?= $ user_needs_encoder ? ', UserPasswordEncoderInterface $passwordEncoder ' : null ?> )
18
+ public function __construct(<?= $ user_is_entity ? 'EntityManagerInterface $entityManager, ' : null ?> UrlGeneratorInterface $urlGenerator, CsrfTokenManagerInterface $csrfTokenManager<?= $ user_needs_encoder ? sprintf ( ', %s $%s ' , $ password_class_details -> getShortName (), $ password_variable_name ) : null ?> )
19
19
{
20
20
<?= $ user_is_entity ? " \$this->entityManager = \$entityManager; \n" : null ?>
21
21
$this->urlGenerator = $urlGenerator;
22
22
$this->csrfTokenManager = $csrfTokenManager;
23
- <?= $ user_needs_encoder ? " \$this->passwordEncoder = \$passwordEncoder ; \n" : null ?>
23
+ <?= $ user_needs_encoder ? sprintf ( " \$this->%s = \$%s ; \n" , $ password_variable_name , $ password_variable_name ) : null ?>
24
24
}
25
25
26
26
public function supports(Request $request)
@@ -65,10 +65,13 @@ public function getUser($credentials, UserProviderInterface $userProvider)
65
65
66
66
public function checkCredentials($credentials, UserInterface $user)
67
67
{
68
- <?= $ user_needs_encoder ? "return \$this->passwordEncoder->isPasswordValid( \$user, \$credentials['password']); \n"
69
- : "// Check the user's password or other credentials and return true or false
68
+ <?php if ($ user_needs_encoder ): ?>
69
+ return $this-><?= $ password_variable_name ?> ->isPasswordValid($user, $credentials['password']);
70
+ <?php else : ?>
71
+ // Check the user's password or other credentials and return true or false
70
72
// If there are no credentials to check, you can just return true
71
- throw new \Exception('TODO: check the credentials inside '.__FILE__); \n" ?>
73
+ throw new \Exception('TODO: check the credentials inside '.__FILE__);
74
+ <?php endif ?>
72
75
}
73
76
74
77
<?php if ($ password_authenticated ): ?>
0 commit comments