commit d74beeb937defb74304f22d9c9159f317f181639
parent cdc371a418277c1e30529596597f2d71e6c787e9
Author: dankert <devnull@localhost>
Date: Mon, 8 Nov 2010 01:43:05 +0100
Liste von OpenId-Providern in Login-Dialog anzeigen.
Diffstat:
3 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/actionClasses/IndexAction.class.php b/actionClasses/IndexAction.class.php
@@ -287,6 +287,13 @@ class IndexAction extends Action
'value'=>Text::maxLength($dbconf['comment']),
'title'=>$dbconf['comment'].' ('.$dbconf['host'].')' );
}
+
+ $openid_provider = array();
+ foreach( explode(',',$conf['security']['openid']['provider']) as $provider )
+ $openid_provider[$provider] = config('security','openid','provider.'.$provider.'.name');
+ $this->setTemplateVar('openid_provider',$openid_provider);
+ $this->setTemplateVar('openid_user_identity',config('security','openid','user_identity'));
+ //$this->setTemplateVar('openid_provider','identity');
if ( empty($dbids) )
@@ -544,7 +551,7 @@ class IndexAction extends Action
function openid()
{
global $conf;
- $openId = new OpenId();
+ $openId = Session::get('openid');
if ( !$openId->checkAuthentication() )
{
@@ -553,6 +560,8 @@ class IndexAction extends Action
$this->callSubAction('showlogin');
return;
}
+
+ //Html::debug($openId);
// Anmeldung wurde mit "is_valid:true" best�tigt.
// Der Benutzer ist jetzt eingeloggt.
@@ -619,9 +628,9 @@ class IndexAction extends Action
setcookie('or_username',$loginName,time()+(60*60*24*30*12*2) );
// Login mit Open-Id.
- if ( !empty($openid_user) )
+ if ( $this->hasRequestVar('openid_provider') && ($this->getRequestVar('openid_provider') != 'identity' || !empty($openid_user)) )
{
- $openId = new OpenId($openid_user);
+ $openId = new OpenId($this->getRequestVar('openid_provider'),$openid_user);
if ( ! $openId->login() )
{
@@ -629,10 +638,11 @@ class IndexAction extends Action
$this->addValidationError('openid_url','');
$this->callSubAction('showlogin');
return;
- }
-
+ }
+
+ Session::set('openid',$openId);
$openId->redirect();
- Http::serverError('Unreachable Code.');
+ die('Unreachable Code');
}
diff --git a/config/security.ini.php b/config/security.ini.php
@@ -1,4 +1,4 @@
-; <?php exit('direct access denied') ?>
+ ; <?php exit('direct access denied') ?>
; Security settings for Openrat - be careful :)
@@ -244,6 +244,7 @@ provider.example.xrds_uri=http://google.com/accounts
; Google supports Open-Id 2.0
provider.google.xrds_uri=http://google.com/accounts/o8/id
provider.google.map_attribute=email
+provider.google.name=Google
provider.google.map_internal=mail
; Yahoo
diff --git a/themes/default/templates/index/showlogin.tpl.src.php b/themes/default/templates/index/showlogin.tpl.src.php
@@ -76,8 +76,11 @@ page
if not:true empty:config:security/openid/logo_url
image url:config:security/openid/logo_url
text key:openid_user
- cell
- input name:openid_url class:name size:20
+ cell
+ radiobox name:openid_provider list:openid_provider
+ if true:var:openid_user_identity
+ radio name:openid_provider value:identity
+ input name:openid_url class:name size:20
if value:size:dbids greaterthan:1
row
row