In my Drupal 8 site, In the comment section, I have one button ("Add new comment"). Clicking on it will open a login pop up and the user will be redirected to the same page. For that, I added the following code.
function my_custom_module_user_login($account) {
$previousUrl = \Drupal::request()->server->get('HTTP_REFERER');
$response = new Symfony\Component\HttpFoundation\RedirectResponse($previousUrl);
$response->send();
return;
}
How can I redirect the users to the front page, or any page, after they logged in via social sites? Is there any Drupal 8 that identifies when users logged in from the social networking sites?
Because of the above code, the login via social media is redirected to the same callback page.
If I remove the above code, the social media login redirects to the front page, but the login from the comment doesn't redirect to the same page. To login from social networks, I am using the OneAll Social Login module.
Comments