reactmay/wow-auth

此包最新版本(dev-master)没有提供许可证信息。

WoW 身份验证包

dev-master 2020-11-14 05:26 UTC

This package is auto-updated.

Last update: 2024-09-20 06:59:58 UTC


README

Laravel 5.6 包,基于 TrinityCore 数据库进行身份验证。

WoW 身份验证基于用户名和密码连接后的 sha1 哈希。

要求

  • PHP >= 5.5.9 || 7.0
  • reactmay/wow-models >= dev-master
  • Laravel => 5.6

安装

composer require reactmay/wow-auth
  • 在您的 config/app.php 中添加服务提供者和外观

服务提供者

'providers' => [
    
    [...]
    
    reactmay\WoWAuth\Providers\WoWAuthServiceProvider::class,
    
    [...]
]

外观

'aliases' => [
    
    [...]
    
    'WoWAuth' => reactmay\WoWAuth\Facades\WoW::class,
    
    [...]
]
  • 在您 config/database.php 中添加数据库连接
'connections' => [

        [...]

        'characters' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST_CHARACTERS', 'localhost'),
            'database'  => env('DB_DATABASE_CHARACTERS', 'forge'),
            'username'  => env('DB_USERNAME_CHARACTERS', 'forge'),
            'password'  => env('DB_PASSWORD_CHARACTERS', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

        'world' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST_WORLD', 'localhost'),
            'database'  => env('DB_DATABASE_WORLD', 'forge'),
            'username'  => env('DB_USERNAME_WORLD', 'forge'),
            'password'  => env('DB_PASSWORD_WORLD', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

        'auth' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST_AUTH', 'localhost'),
            'database'  => env('DB_DATABASE_AUTH', 'forge'),
            'username'  => env('DB_USERNAME_AUTH', 'forge'),
            'password'  => env('DB_PASSWORD_AUTH', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ]

        [...]

    ],
  • 在您的 .env 中添加变量并配置它
DB_HOST_WORLD=localhost
DB_DATABASE_WORLD=world
DB_USERNAME_WORLD=root
DB_PASSWORD_WORLD=root

DB_HOST_CHARACTERS=localhost
DB_DATABASE_CHARACTERS=characters
DB_USERNAME_CHARACTERS=root
DB_PASSWORD_CHARACTERS=root

DB_HOST_AUTH=localhost
DB_DATABASE_AUTH=auth
DB_USERNAME_AUTH=root
DB_PASSWORD_AUTH=root
  • 创建配置文件和视图
php artisan vendor:publish --provider="reactmay\WoWAuth\Providers\WoWAuthServiceProvider"
  • 在 config/wow-auth.php 中配置此包
  • 执行迁移
php artisan migrate

完成了!现在您可以使用此包了

配置

用法

  • 在 config/auth.php 中更改用户提供者或创建一个新的提供者
'providers' => [
        'users' => [
            'driver' => 'wow',
            'model' => reactmay\WoWAuth\Models\Auth\Account::class,
        ],
    ],
  • 在密码重置配置中添加连接名称或在 config/auth.php 中创建一个新的连接
'passwords' => [
        'users' => [
            'provider' => 'users',
            'connection' => 'auth',
            'table' => 'password_resets',
            'expire' => 60,
        ],
    ],
  • 使用以下命令在 routes/web.php 中创建 Auth 路由
WoWAuth::routes(); 

常见问题解答

  • 我能否在首次安装之前激活 Laravel Passport 支持?

是的,您可以使用!将配置值更改为 true 并刷新迁移。所有在激活 Laravel Passport 支持之前创建的账户必须重置密码才能使用密码授权系统。