You are here

function _simplesamlphp_auth_generate_block_text in simpleSAMLphp Authentication 7.3

Same name and namespace in other branches
  1. 6.3 simplesamlphp_auth.module \_simplesamlphp_auth_generate_block_text()
  2. 6.2 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_view in ./simplesamlphp_auth.module
Implements hook_block_view().

File

./simplesamlphp_auth.module, line 534
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>' . t('Logged in as: @username', array(
      '@username' => $user->name,
    )) . '<br />' . l(t('Log Out'), 'user/logout') . '</p>';
  }
  else {
    $login_path = variable_get('simplesamlphp_auth_login_path', 'saml_login');
    $login_name = variable_get('simplesamlphp_auth_login_link_display_name', t('Federated Log In'));
    $block_content .= '<p>' . l($login_name, $login_path) . '</p>';
  }
  return $block_content;
}