faeno / drupal-password-hasher
CakePHP 3.x 的 Drupal 密码哈希器
1.0.0
2019-01-18 04:50 UTC
Requires
- cakephp/cakephp: >=3.0
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); } } }