fawno/drupal-password-hasher

Drupal Password Hasher for CakePHP 3.x

Installs: 13

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 0

Type:cakephp-plugin

1.0.0 2019-01-18 04:50 UTC

This package is auto-updated.

Last update: 2024-10-18 18:40:59 UTC


README

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