mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
da02b741e1
* feat(auth): adding patron role with new permission to bypass feature flags * style: fix StyleCI finding * fix: wiki editors shouldn't have extended CRUD permissions
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Auth\Notifications\ResetPassword;
|
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
use Illuminate\Support\Facades\Config;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Support\Str;
|
|
use Illuminate\Validation\Rules\Password;
|
|
|
|
/**
|
|
* Class AuthServiceProvider.
|
|
*/
|
|
class AuthServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any authentication / authorization services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
Password::defaults(
|
|
fn () => Password::min(8)
|
|
->uncompromised()
|
|
->mixedCase()
|
|
->letters()
|
|
->numbers()
|
|
->symbols()
|
|
->rules('confirmed')
|
|
);
|
|
|
|
ResetPassword::createUrlUsing(function (mixed $user, string $token) {
|
|
return url(Config::get('wiki.reset_password'), ['token' => $token]);
|
|
});
|
|
|
|
Gate::guessPolicyNamesUsing(
|
|
fn (string $modelClass) => Str::of($modelClass)
|
|
->replace('Models', 'Policies')
|
|
->append('Policy')
|
|
->__toString()
|
|
);
|
|
}
|
|
}
|