定制 awema-pl/module-auth 二次开发

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

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

awema-pl/module-auth

Composer 安装命令:

composer require awema-pl/module-auth

包简介

Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).

README 文档

README

Awema.pl logo

Authentication

Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).

Coverage report Last version Build status Downloads License CDN Ready laravel Last commit Analytics Hosted by Package Kit Patreon

Laravel Authentication

Table of Contents

Installation

Via Composer

$ composer require awema-pl/module-auth

The package will automatically register itself.

You can publish migrations:

php artisan vendor:publish --provider="AwemaPL\Auth\AuthServiceProvider" --tag="migrations"

After migrations have been published you can create required db tables by running:

php artisan migrate

Publish views:

php artisan vendor:publish --provider="AwemaPL\Auth\AuthServiceProvider" --tag="views"

Configuration

Publish config file:

php artisan vendor:publish --provider="AwemaPL\Auth\AuthServiceProvider" --tag="config"

You can disable additional features by commenting them out:

'enabled' => [
    'social', 
    // 'two_factor',
    // 'email_verification',
],

Add new socialite services:

'services' => [
    'github' => [
        'name' => 'GitHub'
    ],
    ...
],
'github' => [
    'client_id' => env('GITHUB_CLIENT_ID'),
    ...
],

And configure redirect paths:

'redirects' => [
    'login' => '/twofactor',
    'reset_password' => '/',
    ...
],

Social and two-factor authentication

Several .env variables required if additional modules were enabled in config:

# SOCIALITE GITHUB
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URL=http://auth.test/login/github/callback

# TWO FACTOR AUTHY
AUTHY_SECRET=

If you enabled social and/or two factor authentication add respective traits to User model class:

use AwemaPL\Auth\Models\Traits\HasSocialAuthentication;
use AwemaPL\Auth\Models\Traits\HasTwoFactorAuthentication;

class User extends Authenticatable
{
    use HasSocialAuthentication, HasTwoFactorAuthentication;
}

Email verification & resetting passwords

To use email verification functionality and to reset passwords, add SendsEmailVerification and SendsPasswordReset traits:

use AwemaPL\Auth\Models\Traits\SendsPasswordReset;
use AwemaPL\Auth\Models\Traits\SendsEmailVerification;

class User extends Authenticatable
{
    use SendsEmailVerification, SendsPasswordReset;
}

Usage

Add to routes/web.php:

AwemaAuth::routes();

You can disable registration:

AwemaAuth::routes(['register' => false]);

Package will register several routes.

Besides default authentication routes, it will add:
  • Socialite routes
    • 'login.social'
    • 'login/{service}/callback'
  • Two factor authentication setup routes
    • 'twofactor.index'
    • 'twofactor.store'
    • 'twofactor.destroy'
    • 'twofactor.verify'
  • Two factor authentication login routes
    • 'login.twofactor.index'
    • 'login.twofactor.verify'
  • Email verification routes
    • 'verification.resend'
    • 'verification.code.verify'
    • 'verification.code'
    • 'verification.verify'

Testing

You can run the tests with:

composer test

Contributing

Please see contributing.md for details and a todolist.

Credits

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固