From 6f57ec3e97b5bd987397be4f3798b48b197ba35b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Wed, 9 Aug 2023 22:26:55 +0330 Subject: [PATCH] fix: add limitation if `allowMagicLinkLogins` is `false` --- src/Controllers/MagicLinkController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Controllers/MagicLinkController.php b/src/Controllers/MagicLinkController.php index 45cfb1060..4ff0e86b7 100644 --- a/src/Controllers/MagicLinkController.php +++ b/src/Controllers/MagicLinkController.php @@ -50,6 +50,11 @@ public function __construct() */ public function loginView() { + // Check if magic-link is not allowed + if (! setting('Auth.allowMagicLinkLogins')) { + return redirect()->route('login')->with('error', lang('Auth.magicLinkDisabled')); + } + if (auth()->loggedIn()) { return redirect()->to(config('Auth')->loginRedirect()); } @@ -66,6 +71,11 @@ public function loginView() */ public function loginAction() { + // Check if magic-link is not allowed + if (! setting('Auth.allowMagicLinkLogins')) { + return redirect()->route('login')->with('error', lang('Auth.magicLinkDisabled')); + } + // Validate email format $rules = $this->getValidationRules(); if (! $this->validateData($this->request->getPost(), $rules, [], config('Auth')->DBGroup)) {