定制 ikepu-tp/laravel-secure-auth 二次开发

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

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

ikepu-tp/laravel-secure-auth

最新稳定版本:v1.3.0

Composer 安装命令:

composer require ikepu-tp/laravel-secure-auth

包简介

关键字:

README 文档

README

This package adds more secure authentication in Laravel.

Japanese

Usage

1. install

composer require ikepu-tp/laravel-secure-auth

2. migration

php artisan migrate

3. Configuration files

php artisan vendor:publish --tags=SecureAuth-config

Change the configuration as necessary.

key entries description
expires_minitues token_expires_minutes
token_digits number of digits in token
loginCallback function of login process
login_history Whether to record login history or not
login_email send an email which notify login

Two-factor authentication

Important

Set up the login handling function in the loginCallback configuration file.

    /**
     * Handle an incoming authentication request.
     */
    public function store(LoginRequest $request): RedirectResponse
    {
        $user = User::query()
            ->where("email", $request->validated("email"))
            ->first();
        if (!$user || !Hash::check($request->validated("password"), $user->password)) throw new UnauthorizedException();
        return \ikepu_tp\SecureAuth\app\Http\Services\TfaService::make($user, $request->validated("remember", false));
    }

Record Login History

Important

Issue a login event during the login process.

    public function login(User $user)
    {
        session()->regenerate();
        event(new \ikepu_tp\SecureAuth\app\Events\LoginEvent($user));
        \Illuminate\Support\Facades\Auth::guard($guard)->login($user, $remember);
    }

Contributtion

We welcome contributions to the project! You can get involved through the following ways:

Issue: Use for bug reports, feature suggestions, and more. Pull Requests: We encourage code contributions for new features and bug fixes.

License

See LICENSE.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-28