Repository navigation
fix: password rehash never ran for CakeDC/Auth.Form - #1187
Open
kaihoefler wants to merge 1 commit into
Open
kaihoefler wants to merge 1 commit into
kaihoefler wants to merge 1 commit into
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1186, refs #1170
The rehash in
LoginComponent::handlePasswordRehash()never ran for a form login:CakeDC\Auth\Authenticator\FormAuthenticator, which forwardsgetIdentifier()via__call().method_exists()does not see that, so the method returned early. It now usesis_callable().Auth.PasswordRehash.authenticators.Formwas'Authentication.Password', but that identifier is registered as'Password'in the identifier collection. The default is now'Password'.testLoginRehashWithAuthenticatorStructurenow uses the realFormAuthenticatorand an identifier collection loaded from['Authentication.Password' => []]instead of a mock with an addedgetIdentifier(). Without the change inLoginComponentthe test fails, with it it passes.Test run:
LoginTraitTestpasses. In the full suiteSimpleCrudTraitIntegrationTest::testCrudfails, the same as on16.next-cake5without 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.