You are here

public function SimpleFbConnectPostLoginManager::getPostLoginPath in Simple FB Connect 8.2

Same name and namespace in other branches
  1. 8.3 src/SimpleFbConnectPostLoginManager.php \Drupal\simple_fb_connect\SimpleFbConnectPostLoginManager::getPostLoginPath()

Returns the path the user should be redirected after a successful login.

Return order: 1. Path from query string, if set, valid and not external. 2. Path from module settings, if valid and not external. 3. User page.

Return value

string URL where the user should be redirected after FB login.

File

src/SimpleFbConnectPostLoginManager.php, line 75
Contains \Drupal\simple_fb_connect\SimpleFbConnectPostLoginManager.

Class

SimpleFbConnectPostLoginManager
Contains all logic that is related to post login redirects.

Namespace

Drupal\simple_fb_connect

Code

public function getPostLoginPath() {

  // 1. Read the post login path from session.
  $post_login_path = $this->session
    ->get('simple_fb_connect_post_login_path');
  if ($post_login_path) {
    if ($valid_path = $this
      ->validateInternalPath($post_login_path)) {
      return $valid_path;
    }
  }

  // 2. Use post login path from module settings.
  $post_login_path = $this
    ->getPostLoginPathSetting();
  if ($valid_path = $this
    ->validateInternalPath($post_login_path)) {
    return $valid_path;
  }

  // 3. Use user page.
  $post_login_path = 'user';
  return $this
    ->validateInternalPath($post_login_path);
}