Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions userdemo/module/User/src/Controller/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,19 @@ public function loginAction()

// Get redirect URL.
$redirectUrl = $this->params()->fromPost('redirect_url', '');


// If redirect URL is provided, redirect the user to that URL;
// otherwise redirect to Home page.
if (!empty($redirectUrl)) {
// The below check is to prevent possible redirect attack
// (if someone tries to redirect user to another domain).
$uri = new Uri($redirectUrl);
if (!$uri->isValid() || $uri->getHost()!=null)
if (!$uri->isValid() || $uri->getHost()!=null) {
throw new \Exception('Incorrect redirect URL: ' . $redirectUrl);
}

// If redirect URL is provided, redirect the user to that URL;
// otherwise redirect to Home page.
if(empty($redirectUrl)) {
return $this->redirect()->toRoute('home');
} else {
}
$this->redirect()->toUrl($redirectUrl);
} else {
return $this->redirect()->toRoute('home');
}
} else {
$isLoginError = true;
Expand Down