@@ -50,7 +50,9 @@ public function __construct()
5050 */
5151 public function loginView ()
5252 {
53- $ this ->displayErrorMagicLinkDisabled ();
53+ if (! setting ('Auth.allowMagicLinkLogins ' )) {
54+ return redirect ()->route ('login ' )->with ('error ' , lang ('Auth.magicLinkDisabled ' ));
55+ }
5456
5557 if (auth ()->loggedIn ()) {
5658 return redirect ()->to (config ('Auth ' )->loginRedirect ());
@@ -68,7 +70,9 @@ public function loginView()
6870 */
6971 public function loginAction ()
7072 {
71- $ this ->displayErrorMagicLinkDisabled ();
73+ if (! setting ('Auth.allowMagicLinkLogins ' )) {
74+ return redirect ()->route ('login ' )->with ('error ' , lang ('Auth.magicLinkDisabled ' ));
75+ }
7276
7377 // Validate email format
7478 $ rules = $ this ->getValidationRules ();
@@ -139,7 +143,9 @@ protected function displayMessage(): string
139143 */
140144 public function verify (): RedirectResponse
141145 {
142- $ this ->displayErrorMagicLinkDisabled ();
146+ if (! setting ('Auth.allowMagicLinkLogins ' )) {
147+ return redirect ()->route ('login ' )->with ('error ' , lang ('Auth.magicLinkDisabled ' ));
148+ }
143149
144150 $ token = $ this ->request ->getGet ('token ' );
145151
@@ -219,18 +225,6 @@ private function recordLoginAttempt(
219225 );
220226 }
221227
222- /**
223- * Display error to the user if magic-link is not allowed.
224- *
225- * @return RedirectResponse|void
226- */
227- private function displayErrorMagicLinkDisabled ()
228- {
229- if (! setting ('Auth.allowMagicLinkLogins ' )) {
230- return redirect ()->route ('login ' )->with ('error ' , lang ('Auth.magicLinkDisabled ' ));
231- }
232- }
233-
234228 /**
235229 * Returns the rules that should be used for validation.
236230 *
0 commit comments