Skip to content

Commit fe480bd

Browse files
committed
Dont listen for login
1 parent e00cb80 commit fe480bd

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

src/LaravelOtpServiceProvider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Chrysanthos\LaravelOtp;
44

55
use Chrysanthos\LaravelOtp\Listeners\OtpListener;
6-
use Illuminate\Auth\Events\Login;
76
use Illuminate\Auth\Events\Logout;
87
use Illuminate\Support\Facades\Event;
98
use Spatie\LaravelPackageTools\Package;
@@ -27,7 +26,6 @@ public function configurePackage(Package $package): void
2726
->hasViews()
2827
->hasRoutes('web');
2928

30-
Event::listen(Login::class, [OtpListener::class, 'generate']);
3129
Event::listen(Logout::class, [OtpListener::class, 'clear']);
3230
}
3331
}

src/Listeners/OtpListener.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,11 @@
33
namespace Chrysanthos\LaravelOtp\Listeners;
44

55
use Chrysanthos\LaravelOtp\Support\OtpService;
6-
use Illuminate\Auth\Events\Login;
76
use Illuminate\Auth\Events\Logout;
8-
use Illuminate\Foundation\Auth\User;
97
use Illuminate\Support\Facades\Session;
108

119
class OtpListener
1210
{
13-
public function generate(Login $event)
14-
{
15-
/** @var User $user */
16-
$user = $event->user;
17-
18-
if (method_exists($user, 'shouldGoThroughOtp') && $user->shouldGoThroughOtp() === false) {
19-
return;
20-
}
21-
22-
app(OtpService::class)->generateOtpAndSend($user);
23-
}
24-
2511
public function clear(Logout $event)
2612
{
2713
Session::forget(

0 commit comments

Comments
 (0)