aboutsummaryrefslogtreecommitdiff
path: root/actions/openid_client/login.php
blob: 2a6896a611986faf82d037da74a24626a0f707ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
 * OpenID client login action
 */

elgg_load_library('openid_consumer');

$provider = get_input('openid_provider');
$persistent = get_input('persistent', false);

if ($provider == 'others') {
	$provider = get_input('openid_url');
}

$consumer = new ElggOpenIDConsumer($store);
$consumer->setURL($provider);
$consumer->setReturnURL(elgg_get_site_url() . "mod/openid_client/return.php?persistent=$persistent");

$html = $consumer->requestAuthentication();
if ($html) {
	echo $html;
	exit;
} else {
	$flipped_providers = array_flip(elgg_get_config('openid_providers'));
	if (isset($flipped_providers[$provider])) {
		$provider_name = $flipped_providers[$provider];
	} else {
		$provider_name = $provider;
	}
	register_error(elgg_echo('openid_client:error:no_html', array($provider_name)));
	forward();
}