How to change default hash password in cakephp?

by darrion.kuhn , in category: PHP Frameworks , 6 months ago

How to change default hash password in cakephp?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by daisha , 6 months ago

@darrion.kuhn 

To change the default hash password in CakePHP, you need to follow these steps:

  1. Open the file src/Application.php in your CakePHP project.
  2. Locate the __construct() method and find the following line: $this->add(new AuthenticationServiceProvider());
  3. After that line, add the following code to override the default password hasher: $this->authentication->addUnauthenticatedCallable(function () { return new AuthenticationPasswordHasherDefaultPasswordHasher([ 'hashType' => '
  4. Save the changes and exit the file.


Now, the default password hasher in CakePHP will use your chosen hash type instead of the default one.