protected function AuthenticationController::getDestinationUrl in Janrain Registration 8
Returns the URL to redirect to.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request.
Return value
\Drupal\Core\Url The URL to redirect to.
File
- src/
Controller/ AuthenticationController.php, line 207
Class
- AuthenticationController
- Authentication controller.
Namespace
Drupal\janrain_capture\ControllerCode
protected function getDestinationUrl(Request $request) : Url {
// See whether the request has HTTP referer.
if ($request->server
->has('HTTP_REFERER')) {
$request_uri = new Uri($request
->getUri());
$referer_uri = new Uri($request->server
->get('HTTP_REFERER'));
// Make sure we'll not redirect out of the current origin.
if ($referer_uri
->getAuthority() === $request_uri
->getAuthority()) {
return Url::fromUserInput($referer_uri
->getPath(), [
'query' => parse_query($referer_uri
->getQuery()),
]);
}
}
// Fallback to the front page.
return Url::fromRoute('<front>');
}