Skip to content

Commit 011884d

Browse files
committed
Cleared the shared email service within the calling controller/action instead of the �mailer() helper
1 parent 721d349 commit 011884d

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

src/Authentication/Actions/Email2FA.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ public function handle(IncomingRequest $request)
8080
throw new RuntimeException('Cannot send email for user: ' . $user->email . "\n" . $email->printDebugger(['headers']));
8181
}
8282

83+
// Clear the email
84+
$email->clear();
85+
8386
return view(setting('Auth.views')['action_email_2fa_verify']);
8487
}
8588

src/Authentication/Actions/EmailActivator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public function show(): string
5050
throw new RuntimeException('Cannot send email for user: ' . $user->email . "\n" . $email->printDebugger(['headers']));
5151
}
5252

53+
// Clear the email
54+
$email->clear();
55+
5356
// Display the info page
5457
return view(setting('Auth.views')['action_email_activate_show'], ['user' => $user]);
5558
}

src/Controllers/MagicLinkController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ public function loginAction()
101101
return redirect()->route('magic-link')->with('error', lang('Auth.unableSendEmailToUser', [$user->email]));
102102
}
103103

104+
// Clear the email
105+
$email->clear();
106+
104107
return $this->displayMessage();
105108
}
106109

src/Helpers/email_helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function emailer(array $overrides = []): Email
4141
}
4242

4343
/** @var Email $email */
44-
$email = service('email', false);
44+
$email = service('email');
4545

4646
return $email->initialize($config);
4747
}

0 commit comments

Comments
 (0)