The method described in http://drupal.org/node/1850524 is not working because the autoloader won't find the MyPasswordHasher class.

It is also outdated because instead of the bundle classes it should use bundle YAMLs.

Comments

xjm’s picture

Category: bug » task
Priority: Normal » Critical
Issue tags: +Needs change record
smiletrl’s picture

Assigned: Unassigned » smiletrl

Let me try to do this:)

chx’s picture

This should not serve as a site specific override. Just write a module. Change the bundle to a modulename.services.yml. For how those look, ample examples in core/core.services.yml

smiletrl’s picture

Change log2 iteration count for default password hashing implementation

drupal8, in custom module mymodule directory, add file mymodule.sevices.yml containing:

services:
  password:
    class: Drupal\Core\Password\PhpassHashedPassword
    arguments: [19]

This would override default iteration count in core.

Substitute default password hashing implementation

drupal8, in custom module mymodule directory, add file mymodule.sevices.yml containing:

services:
  password:
    class: Drupal\mymodule\MyPassword\MyPasswordHasher
    arguments: [16]

Contents of Drupal\mymodule\MyPassword\MyPasswordHasher.php should implement PasswordInterface, like this:


/**
 * @file
 * Definition of Drupal\mymodule\MyPassword\MyPasswordHasher
 */

use Drupal\Core\Password;

/**
 * My custom secure password hashing functions.
 */
class MyPasswordHasher implements PasswordInterface {
  // Custom code for hashing.
}

This will override default password hashing implementation.

Berdir’s picture

Feel free to simply update the change notice, it can always be tuned further :)

chx’s picture

Status: Active » Fixed

Thanks a ton. I updated the change notice.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xjm’s picture

Issue tags: -Needs change record

Untagging. Please remove the "Needs change notification" tag when the change notice task is complete.