You are here

function _simplesamlphp_auth_generate_block_text in simpleSAMLphp Authentication 6.2

Same name and namespace in other branches
  1. 6.3 simplesamlphp_auth.module \_simplesamlphp_auth_generate_block_text()
  2. 7.3 simplesamlphp_auth.module \_simplesamlphp_auth_generate_block_text()
  3. 7 simplesamlphp_auth.module \_simplesamlphp_auth_generate_block_text()
  4. 7.2 simplesamlphp_auth.module \_simplesamlphp_auth_generate_block_text()

Generates the text for the log in block.

1 call to _simplesamlphp_auth_generate_block_text()
simplesamlphp_auth_block in ./simplesamlphp_auth.module
Implementation of hook_block().

File

./simplesamlphp_auth.module, line 712
simpleSAMLphp authentication module for Drupal.

Code

function _simplesamlphp_auth_generate_block_text() {
  global $_simplesamlphp_auth_as;
  $block_content = '';
  global $user;
  if (!_simplesamlphp_auth_isEnabled()) {

    // Exit without executing.
    return;
  }

  // Check if valid local session exists.
  if ($_simplesamlphp_auth_as
    ->isAuthenticated()) {
    $block_content .= '<p>Logged in as: ' . $user->name . '<br /><a href="/logout">' . t('Federated logout') . '</a></p>';
  }
  else {
    $block_content .= '<p><a href="saml_login">' . t('Federated login') . '</a></p>';
  }
  return $block_content;
}