Skip to content

fix: password rehash never ran for CakeDC/Auth.Form - #1187

Open
kaihoefler wants to merge 1 commit into
CakeDC:16.next-cake5from
kaihoefler:fix/password-rehash-form-authenticator
Open

kaihoefler wants to merge 1 commit into
CakeDC:16.next-cake5from
kaihoefler:fix/password-rehash-form-authenticator

Conversation

@kaihoefler

@kaihoefler kaihoefler commented Oct 11, 2026 •

Copy link
Copy Markdown

Fixes #1186, refs #1170

The rehash in LoginComponent::handlePasswordRehash() never ran for a form login:

  • The provider is CakeDC\Auth\Authenticator\FormAuthenticator, which forwards getIdentifier() via __call(). method_exists() does not see that, so the method returned early. It now uses is_callable().
  • The default Auth.PasswordRehash.authenticators.Form was 'Authentication.Password', but that identifier is registered as 'Password' in the identifier collection. The default is now 'Password'.

testLoginRehashWithAuthenticatorStructure now uses the real FormAuthenticator and an identifier collection loaded from ['Authentication.Password' => []] instead of a mock with an added getIdentifier(). Without the change in LoginComponent the test fails, with it it passes.

Test run: LoginTraitTest passes. In the full suite SimpleCrudTraitIntegrationTest::testCrud fails, the same as on 16.next-cake5 without this change. phpcs reports no new violations.

Note for existing apps: an app config with 'Form' => 'Authentication.Password' still does not find the identifier and now logs a warning instead of skipping silently.

- LoginComponent::handlePasswordRehash() checked
  method_exists($provider, 'getIdentifier'), but
  CakeDC\Auth\Authenticator\FormAuthenticator proxies getIdentifier()
  to the base authenticator via __call, so the check was always false
  and the rehash was skipped silently. Use is_callable() instead.
- Default Auth.PasswordRehash.authenticators.Form is now 'Password':
  the identifier configured as 'Authentication.Password' is registered
  as 'Password' in the identifier collection.
- The test now uses the real FormAuthenticator and an identifier
  collection loaded like the default configuration instead of a mock
  with an added getIdentifier() method.

Refs CakeDC#1170

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Password rehash never runs with CakeDC/Auth.Form (16.0.4)

1 participant