From f58a134f763c835659d3cc8bcc7e46c098941810 Mon Sep 17 00:00:00 2001 From: Chrysanthos <48060191+chrysanthos@users.noreply.github.com> Date: Sat, 13 Jul 2024 08:40:49 +0300 Subject: [PATCH] Check if user exists --- src/Listeners/OtpListener.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Listeners/OtpListener.php b/src/Listeners/OtpListener.php index a8622f9..28cd92b 100644 --- a/src/Listeners/OtpListener.php +++ b/src/Listeners/OtpListener.php @@ -10,12 +10,14 @@ class OtpListener { public function clear(Logout $event) { - Session::forget( - app(OtpService::class)->generateVerifiedKey($event->user) - ); + if ($event->user) { + Session::forget( + app(OtpService::class)->generateVerifiedKey($event->user) + ); - Session::forget( - app(OtpService::class)->generateOtpSentKey($event->user) - ); + Session::forget( + app(OtpService::class)->generateOtpSentKey($event->user) + ); + } } }