Skip to content

Latest commit

 

History

History
41 lines (34 loc) · 917 Bytes

README.md

File metadata and controls

41 lines (34 loc) · 917 Bytes

DrupalPasswordHasher

DrupalPasswordHasher for CakePHP 3.x

Install

composer require fawno/drupal-password-hasher

Config AppController.php

  use Fawno\Auth\DrupalPasswordHasher;

  $this->loadComponent('Auth', [
    'authenticate' => [
      'Form' => [
        'passwordHasher' => DrupalPasswordHasher::class,
        'fields' => [
          'username' => 'username',
          'password' => 'password',
        ]
      ]
    ],
  ]);

Config Model/Entity/User.php

  use Fawno\Auth\DrupalPasswordHasher;

  class User extends Entity {
    protected function _setPassword ($value) {
      if (strlen($value)) {
        $hasher = new DrupalPasswordHasher();

        return $hasher->hash($value);
      }
    }
  }