faeno/drupal-password-hasher

CakePHP 3.x 的 Drupal 密码哈希器

安装: 13

依赖关系: 0

建议者: 0

安全性: 0

星标: 0

关注者: 3

分支: 0

公开问题: 0

类型:cakephp-plugin

1.0.0 2019-01-18 04:50 UTC

This package is auto-updated.

Last update: 2024-09-18 18:28:36 UTC


README

DrupalPasswordHasher

DrupalPasswordHasher for CakePHP 3.x

安装

composer require fawno/drupal-password-hasher

配置 AppController.php

  use Fawno\Auth\DrupalPasswordHasher;

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

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