Loading core/modules/user/src/Controller/UserAuthenticationController.php +1 −1 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ public function login(Request $request) { $authenticated = $this->userAuth->authenticateAccount($account, $credentials['pass']) ? $account->id() : FALSE; } else { $authenticated = $this->userAuth->authenticateAccount($credentials['name'], $credentials['pass']); $authenticated = $this->userAuth->authenticate($credentials['name'], $credentials['pass']); } if ($authenticated) { $this->userFloodControl->clear('user.http_login', $this->getLoginFloodIdentifier($request, $credentials['name'])); Loading core/modules/user/src/Form/UserLoginForm.php +7 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,13 @@ public function validateAuthentication(array &$form, FormStateInterface $form_st if ($this->userAuth instanceof UserAuthenticationInterface) { $form_state->set('uid', $this->userAuth->authenticateAccount($account, $password) ? $account->id() : FALSE); } // The userAuth object is decorated by an object that that has not // been upgraded to the new UserAuthenticationInterface. Fallback // to the authenticate() method. else { $uid = $this->userAuth->authenticate($form_state->getValue('name'), $password); $form_state->set('uid', $uid); } } elseif (!$this->userAuth instanceof UserAuthenticationInterface) { $uid = $this->userAuth->authenticate($form_state->getValue('name'), $password); Loading core/modules/user/tests/modules/user_auth_decorator_test/src/UserAuthDecorator.php 0 → 100644 +28 −0 Original line number Diff line number Diff line <?php namespace Drupal\user_auth_decorator_test; use Drupal\user\UserAuthInterface; /** * Helper to validate UserAuthInterface BC layers are functional. */ class UserAuthDecorator implements UserAuthInterface { /** * Constructs a UserAuthDecorator object. * * @param \Drupal\user\UserAuthInterface $inner * The inner User.Auth service. */ public function __construct(protected UserAuthInterface $inner) { } /** * {@inheritdoc} */ public function authenticate($username, #[\SensitiveParameter] $password) { return $this->inner->authenticate($username, $password); } } core/modules/user/tests/modules/user_auth_decorator_test/user_auth_decorator_test.info.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line name: 'User Auth Service decorated only with UserAuthInterface' type: module description: 'Support module for user authentication testing.' package: Testing version: VERSION core/modules/user/tests/modules/user_auth_decorator_test/user_auth_decorator_test.services.yml 0 → 100644 +6 −0 Original line number Diff line number Diff line services: user_auth_decorator.user.auth: class: \Drupal\user_auth_decorator_test\UserAuthDecorator decorates: user.auth arguments: - '@user_auth_decorator.user.auth.inner' Loading
core/modules/user/src/Controller/UserAuthenticationController.php +1 −1 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ public function login(Request $request) { $authenticated = $this->userAuth->authenticateAccount($account, $credentials['pass']) ? $account->id() : FALSE; } else { $authenticated = $this->userAuth->authenticateAccount($credentials['name'], $credentials['pass']); $authenticated = $this->userAuth->authenticate($credentials['name'], $credentials['pass']); } if ($authenticated) { $this->userFloodControl->clear('user.http_login', $this->getLoginFloodIdentifier($request, $credentials['name'])); Loading
core/modules/user/src/Form/UserLoginForm.php +7 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,13 @@ public function validateAuthentication(array &$form, FormStateInterface $form_st if ($this->userAuth instanceof UserAuthenticationInterface) { $form_state->set('uid', $this->userAuth->authenticateAccount($account, $password) ? $account->id() : FALSE); } // The userAuth object is decorated by an object that that has not // been upgraded to the new UserAuthenticationInterface. Fallback // to the authenticate() method. else { $uid = $this->userAuth->authenticate($form_state->getValue('name'), $password); $form_state->set('uid', $uid); } } elseif (!$this->userAuth instanceof UserAuthenticationInterface) { $uid = $this->userAuth->authenticate($form_state->getValue('name'), $password); Loading
core/modules/user/tests/modules/user_auth_decorator_test/src/UserAuthDecorator.php 0 → 100644 +28 −0 Original line number Diff line number Diff line <?php namespace Drupal\user_auth_decorator_test; use Drupal\user\UserAuthInterface; /** * Helper to validate UserAuthInterface BC layers are functional. */ class UserAuthDecorator implements UserAuthInterface { /** * Constructs a UserAuthDecorator object. * * @param \Drupal\user\UserAuthInterface $inner * The inner User.Auth service. */ public function __construct(protected UserAuthInterface $inner) { } /** * {@inheritdoc} */ public function authenticate($username, #[\SensitiveParameter] $password) { return $this->inner->authenticate($username, $password); } }
core/modules/user/tests/modules/user_auth_decorator_test/user_auth_decorator_test.info.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line name: 'User Auth Service decorated only with UserAuthInterface' type: module description: 'Support module for user authentication testing.' package: Testing version: VERSION
core/modules/user/tests/modules/user_auth_decorator_test/user_auth_decorator_test.services.yml 0 → 100644 +6 −0 Original line number Diff line number Diff line services: user_auth_decorator.user.auth: class: \Drupal\user_auth_decorator_test\UserAuthDecorator decorates: user.auth arguments: - '@user_auth_decorator.user.auth.inner'