mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-28 10:24:45 +02:00
Remove event dispatcher explicit usage
This commit is contained in:
parent
1d96ed8869
commit
44b9eb2358
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Extensions\Illuminate\Database\Eloquent;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||
|
||||
class Builder extends EloquentBuilder
|
||||
{
|
||||
/**
|
||||
* Do nothing.
|
||||
*/
|
||||
public function search(): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Extensions\Illuminate\Events\Contracts;
|
||||
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
interface SubscribesToEvents
|
||||
{
|
||||
public function subscribe(Dispatcher $events): void;
|
||||
}
|
@ -8,7 +8,7 @@ use Illuminate\Http\Request;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Facades\Activity;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class LoginController extends AbstractLoginController
|
||||
{
|
||||
|
@ -8,7 +8,6 @@ use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Contracts\Hashing\Hasher;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Auth\Events\PasswordReset;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use App\Exceptions\DisplayException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
@ -29,7 +28,6 @@ class ResetPasswordController extends Controller
|
||||
* ResetPasswordController constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
private Dispatcher $dispatcher,
|
||||
private Hasher $hasher,
|
||||
) {
|
||||
}
|
||||
@ -78,7 +76,7 @@ class ResetPasswordController extends Controller
|
||||
$user->setRememberToken(Str::random(60));
|
||||
$user->save();
|
||||
|
||||
$this->dispatcher->dispatch(new PasswordReset($user));
|
||||
event(new PasswordReset($user));
|
||||
|
||||
// If the user is not using 2FA log them in, otherwise skip this step and force a
|
||||
// fresh login where they'll be prompted to enter a token.
|
||||
|
@ -6,18 +6,10 @@ use GuzzleHttp\Client;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Events\Auth\FailedCaptcha;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class VerifyReCaptcha
|
||||
{
|
||||
/**
|
||||
* VerifyReCaptcha constructor.
|
||||
*/
|
||||
public function __construct(private Dispatcher $dispatcher)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*/
|
||||
@ -45,12 +37,7 @@ class VerifyReCaptcha
|
||||
}
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch(
|
||||
new FailedCaptcha(
|
||||
$request->ip(),
|
||||
!empty($result) ? ($result->hostname ?? null) : null
|
||||
)
|
||||
);
|
||||
event(new FailedCaptcha($request->ip(), $result->hostname ?? null));
|
||||
|
||||
throw new HttpException(Response::HTTP_BAD_REQUEST, 'Failed to validate reCAPTCHA data.');
|
||||
}
|
||||
|
@ -5,10 +5,9 @@ namespace App\Listeners\Auth;
|
||||
use App\Facades\Activity;
|
||||
use Illuminate\Auth\Events\Failed;
|
||||
use App\Events\Auth\DirectLogin;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use App\Extensions\Illuminate\Events\Contracts\SubscribesToEvents;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
|
||||
class AuthenticationListener implements SubscribesToEvents
|
||||
class AuthenticationListener
|
||||
{
|
||||
/**
|
||||
* Handles an authentication event by logging the user and information about
|
||||
|
Loading…
x
Reference in New Issue
Block a user