Skip to content

Commit

Permalink
revert: back to old ver
Browse files Browse the repository at this point in the history
  • Loading branch information
datamweb committed Aug 12, 2023
1 parent 48aa475 commit eb53758
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/Controllers/MagicLinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public function __construct()
*/
public function loginView()
{
$this->displayErrorMagicLinkDisabled();
if (! setting('Auth.allowMagicLinkLogins')) {
return redirect()->route('login')->with('error', lang('Auth.magicLinkDisabled'));
}

if (auth()->loggedIn()) {
return redirect()->to(config('Auth')->loginRedirect());
Expand All @@ -68,7 +70,9 @@ public function loginView()
*/
public function loginAction()
{
$this->displayErrorMagicLinkDisabled();
if (! setting('Auth.allowMagicLinkLogins')) {
return redirect()->route('login')->with('error', lang('Auth.magicLinkDisabled'));
}

// Validate email format
$rules = $this->getValidationRules();
Expand Down Expand Up @@ -139,7 +143,9 @@ protected function displayMessage(): string
*/
public function verify(): RedirectResponse
{
$this->displayErrorMagicLinkDisabled();
if (! setting('Auth.allowMagicLinkLogins')) {
return redirect()->route('login')->with('error', lang('Auth.magicLinkDisabled'));
}

$token = $this->request->getGet('token');

Expand Down Expand Up @@ -219,18 +225,6 @@ private function recordLoginAttempt(
);
}

/**
* Display error to the user if magic-link is not allowed.
*
* @return RedirectResponse|void
*/
private function displayErrorMagicLinkDisabled()
{
if (! setting('Auth.allowMagicLinkLogins')) {
return redirect()->route('login')->with('error', lang('Auth.magicLinkDisabled'));
}
}

/**
* Returns the rules that should be used for validation.
*
Expand Down

0 comments on commit eb53758

Please sign in to comment.