Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/en/password-hashers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ fallback hasher as follows::
'passwordHasher' => [
'className' => 'Authentication.Fallback',
'hashers' => [
'Authentication.Default' => [
'Authentication.Default',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about this?

Copy link
Copy Markdown
Contributor Author

@txj txj Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, with the current config both the Default and Legacy hashers do not work, I cannot login with either a bcrypt or sha1 encrypted password. With the fix both work correctly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dereuromark

$hasher = new FallbackPasswordHasher(['hashers' => ['Authentication.Legacy', 'Authentication.Default']]);

[
'className' => 'Authentication.Legacy',
'hashType' => 'md5',
'salt' => false, // turn off default usage of salt
Expand All @@ -68,8 +69,7 @@ password needs to be upgraded::

// regardless of POST or GET, redirect if user is logged in
if ($result->isValid()) {
// Assuming you are using the `Password` identifier.
if ($authentication->identifiers()->get('Password')->needsPasswordRehash()) {
if ($authentication->getIdentificationProvider()->needsPasswordRehash()) {
// Rehash happens on save.
$user = $this->Users->get($authentication->getIdentity()->getIdentifier());
$user->password = $this->request->getData('password');
Expand Down