Skip to content

Commit

Permalink
fix: add limitation if allowMagicLinkLogins is false
Browse files Browse the repository at this point in the history
  • Loading branch information
datamweb committed Aug 9, 2023
1 parent fb5484d commit 6f57ec3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Controllers/MagicLinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand All @@ -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)) {
Expand Down

0 comments on commit 6f57ec3

Please sign in to comment.