You are here

protected function SettingsTrait::getPostLoginRedirection in Social Auth 3.x

Same name and namespace in other branches
  1. 8.2 src/SettingsTrait.php \Drupal\social_auth\SettingsTrait::getPostLoginRedirection()

Returns the Post Login redirection.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Post Login Path to which the user would be redirected after login.

4 calls to SettingsTrait::getPostLoginRedirection()
UserAuthenticator::associateNewProvider in src/User/UserAuthenticator.php
Associates an existing user with a new provider.
UserAuthenticator::authenticateExistingUser in src/User/UserAuthenticator.php
Authenticates and redirects existing users in authentication process.
UserAuthenticator::authenticateNewUser in src/User/UserAuthenticator.php
Authenticates and redirects new users in authentication process.
UserAuthenticator::authenticateUser in src/User/UserAuthenticator.php
Creates and/or authenticates an user.

File

src/SettingsTrait.php, line 136

Class

SettingsTrait
Helper methods for Social Auth and Drupal settings.

Namespace

Drupal\social_auth

Code

protected function getPostLoginRedirection() {

  // Gets destination parameter previously stored in session.
  $destination = $this->dataHandler
    ->get('login_destination');

  // If there was a destination parameter.
  if ($destination) {

    // Deletes the session key.
    $this->dataHandler
      ->set('login_destination', NULL);
    return new RedirectResponse(Url::fromUserInput($destination)
      ->toString());
  }
  $post_login = $this->configFactory
    ->get('social_auth.settings')
    ->get('post_login');
  return new RedirectResponse(Url::fromUserInput($post_login)
    ->toString());
}