https://github.com/kettasoft/passaudit
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.
https://github.com/kettasoft/passaudit
checker checking passaudit password passwords security
Last synced: 3 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/kettasoft/passaudit
- Owner: kettasoft
- License: mit
- Created: 2023-09-13T14:07:30.000Z (over 1 year ago)
- Default Branch: develop
- Last Pushed: 2024-07-18T07:05:06.000Z (11 months ago)
- Last Synced: 2025-01-20T21:40:24.856Z (4 months ago)
- Topics: checker, checking, passaudit, password, passwords, security
- Language: PHP
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PassAudit
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:
```bash
composer require kettasoft/pass-audit
```## Configuration
1. **Register Service Provider**
- Add the service provider to the config/app.php file in the providers array:
```php
'providers' => [
Kettasoft\PassAudit\PassAuditServiceProvider::class,
...
],
```**Publish Configuration**
- Publish the package configuration file:
```dash
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:
```dash
php artisan vendor:publish --provider="Kettasoft\PassAudit\PassAuditServiceProvider" --tag="migrations"
```Then, run the migration:
```dash
php artisan migrate
```## Usage
**Use Trait in User Model**
Add the `PassAudit` trait to your `User` model:
```php
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`:
```php
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:
```php
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.