You are here

public function SimpleFbConnectPostLoginManager::getPostLoginPath in Simple FB Connect 8.3

Same name and namespace in other branches
  1. 8.2 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 78

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->persistentDataHandler
    ->get('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);
}