定制 kettasoft/pass-audit 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kettasoft/pass-audit

最新稳定版本:v1.0.0

Composer 安装命令:

composer require kettasoft/pass-audit

包简介

PassAudit is a powerful and efficient Laravel package designed to enhance the security of user passwords in your application. This package provides a comprehensive solution to prevent users from reusing their previous passwords, thereby mitigating the risk of unauthorized access.

README 文档

README

Latest Version Build Status Total Downloads

PassAudit is a powerful and efficient Laravel package designed to enhance the security of user passwords in your application. This package provides a comprehensive solution to prevent users from reusing their previous passwords, thereby mitigating the risk of unauthorized access.

Installation

You can install the package via Composer:

composer require kettasoft/pass-audit

Configuration

  1. Register Service Provider
  • Add the service provider to the config/app.php file in the providers array:
'providers' => [
    Kettasoft\PassAudit\PassAuditServiceProvider::class,
    ...
],

Publish Configuration

  • Publish the package configuration file:
php artisan vendor:publish --provider="Kettasoft\PassAudit\PassAuditServiceProvider" --tag="config"
  • This will create a passaudit.php file in your config directory where you can customize the settings.

Publish Migration

  • Publish the migration file:
php artisan vendor:publish --provider="Kettasoft\PassAudit\PassAuditServiceProvider" --tag="migrations"

Then, run the migration:

php artisan migrate

Usage

Use Trait in User Model

Add the PassAudit trait to your User model:

namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Kettasoft\PassAudit\PassAudit;

class User extends Authenticatable
{
    use PassAudit;

    //...
}

Implement Interface to User Model

  • Ensure your User model implements the HasPassAuditChecker:
namespace App\Models;

use Kettasoft\PassAudit\Contracts\HasPassAuditChecker;

class User extends Authenticatable implements HasPassAuditChecker
{
    //
}

Use Rule Validation in Request

  • You can use the PassAuditRule in your request validation to prevent users from reusing their previous passwords:
namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Kettasoft\PassAudit\Rules\PassAuditRule;

class UpdatePasswordRequest extends FormRequest
{
    public function rules()
    {
        return [
            'password' => ['required', 'string', 'min:8', new PassAuditRule($this->user())],
        ];
    }
}

Customization

You can customize the behavior of the package by modifying the passaudit.php configuration file. Options include:

  • The number of previous passwords to keep track of
  • The hashing algorithm to use

Contributing

Thank you for considering contributing to PassAudit! Please read the contributing guide before making a pull request.

License

PassAudit is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固