function generate_login_text in Shibboleth Authentication 6.2
Same name and namespace in other branches
- 5.3 shib_auth.module \generate_login_text()
- 5.2 shib_auth.module \generate_login_text()
- 6 shib_auth.module \generate_login_text()
- 6.3 shib_auth.module \generate_login_text()
Generate the login text in HTML format using the 't' function @returns HTML text of the login form
2 calls to generate_login_text()
- shib_auth_block in ./
shib_auth.module - Generate the HTML text for the shib_auth login block
- shib_auth_form_alter in ./
shib_auth.module - Alters forms for the shibboleth authentication module.
File
- ./
shib_auth.module, line 94
Code
function generate_login_text() {
global $base_url, $user;
if (!$user->uid) {
$handlerURL = variable_get('shib_auth_handler_url', '/Shibboleth.sso');
$handlerProtocol = variable_get('shib_auth_handler_protocol', 'https');
$wayfURI = variable_get('shib_auth_wayf_uri', '/WAYF/HREF');
// If the WAYF's URI doesn't start with slash then extend it
if (!ereg("^/", $wayfURI)) {
$wayfURI = "/" . $wayfURI;
}
$handler = '';
$block_content = '';
if (ereg("^http[s]{0,1}://", $handlerURL)) {
// If handlerURL is an absolute path
$handler = $handlerURL . $wayfURI;
}
else {
// Else, if the handlerURL is a relative path
// If the WAYF's URI doesn't start with slash then extend it
if (!ereg("^/", $handlerURL)) {
$handlerURL = "/" . $handlerURL;
}
$handler = $handlerProtocol . "://" . $_SERVER['HTTP_HOST'] . $handlerURL . $wayfURI;
}
//$actualLocation: the path where the Shibboleth should return
$actualLocation = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
// If there is no session yet then we should put the login text into the block
$block_content .= "<p><b><a href=\"{$handler}?target={$actualLocation}\">" . variable_get('auth_link_text', t('Click here to login via Shibboleth!')) . "</a></b></p>";
return $block_content;
}
}