This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
samlauth-elgg/views/default/account/forms/login.php

45 lines
1.2 KiB
PHP

<?php
/**
* Elgg SAML v2.0 authentication
*
* @package ElggSAMLAuth
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Jerome Schneider <jschneider@entrouvert.com>
*/
require_once('/usr/share/simplesamlphp/lib/_autoload.php');
$SAML = true;
try {
$as = new SimpleSAML_Auth_Simple(get_plugin_setting('sp_name', 'saml_auth'));
} catch (Exception $e) {
$SAML = false;
register_error(elgg_echo('saml_auth:samlerror'));
}
if (array_key_exists('login', $_REQUEST))
{
try {
$as->requireAuth();
} catch (Exception $e) {
$SAML = false;
register_error(elgg_echo('saml_auth:samlerror'));
}
}
$isAuth = $as->isAuthenticated();
?>
<?php if ($SAML == true): ?>
<div id="login-box">
<h2><?php echo elgg_echo('login'); ?></h2>
<form method="post" action="/">
<?php echo '<p>' . elgg_echo('saml_auth:account:authentication:text') . '</p>' ?>
<input type="hidden" value="1" name="login">
<input type="submit" value="<? echo elgg_echo('login') ?>" class="submit_button" name="">
</form>
</div>
<?php else: ?>
<?php echo elgg_view("account/forms/default_login"); ?>
<?php endif; ?>