drewlabs/passwords 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

drewlabs/passwords

最新稳定版本:v0.2.20

Composer 安装命令:

composer require drewlabs/passwords

包简介

Password resets implementation for drewlabs auth library

README 文档

README

Password reset is a workflow that allow application users to modify their connection credential a.k.a password while not being connected to the application. drewlabs/passwords is a framework agnostic password reset workflow for PHP programming language, that support link based and otp based password reset.

Usage

The library ships with command classes for creating password reset link/otp a.k.a One Time Password, and other commands to validated the generated token or otp.

  • Request password reset
use Drewlabs\Passwords\Commands\CreatePasswordResetCommand;
use Drewlabs\Passwords\PasswordResetTokenRepository;
use Drewlabs\Passwords\UrlFactory;
use Drewlabs\Passwords\Contracts\TokenInterface;
use Drewlabs\Passwords\Contracts\CanResetPassword;

$repository = new PasswordResetTokenRepository(new Connection('sqlite:memory', 'password_resets'));
$command = new CreatePasswordResetCommand($repository, new CanResetPasswordProvider, 'MySecret');

// Create a password reset link
$command->handle('user@example.com', function(CanResetPassword $user, TokenInterface $token) {
    // TODOL: the command is completed, generate the password reset link
});


//

Note In the code above the CanResetPasswordProvider is a fake user resolver implementation. Library users must provide their own user resolver that implement Drewlabs\Passwords\Contracts\CanResetPasswordProvider contract.

  • Generate password reset OTP

Documentation is under development, any API changes or feature will be added accordingly.

  • Passsword reset token repository

The drewlabs/passwords library ship a reset tokens repository implementation that is extensible by creating drivers that implements Drewlabs\Passwords\Contracts\ConnectionInterface contract.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-26