Skip to content

fawno/DrupalPasswordHasher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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);
      }
    }
  }