openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit f45d22b9e9662929f7794568b9047ce80ea3eebe
parent bb6658bbc67e0afecac9046fa5ff8cf811ba1a67
Author: Jan Dankert <devnull@localhost>
Date:   Tue,  6 Mar 2012 00:30:35 +0100

OpenId-Login in eigener View.

Diffstat:
action/LoginAction.class.php | 115++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------
language/de.ini.php | 6++++++
themes/default/images/icon/license.png | 0
themes/default/images/icon/openid.png | 0
themes/default/images/icon/register.png | 0
themes/default/images/icon/structure.png | 0
themes/default/layout/perspective/login.ini.php | 2+-
themes/default/templates/login/login.tpl.src.xml | 21---------------------
themes/default/templates/login/openid.tpl.src.xml | 56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 157 insertions(+), 43 deletions(-)

diff --git a/action/LoginAction.class.php b/action/LoginAction.class.php @@ -186,15 +186,15 @@ class LoginAction extends Action * Login-Fehlermeldung erscheinen kann */ function loginView() - { - global $conf; + { + global $conf; $sso = $conf['security']['sso']; $ssl = $conf['security']['ssl']; $ssl_trust = false; $ssl_user_var = ''; extract( $ssl, EXTR_PREFIX_ALL, 'ssl' ); - + if ( $sso['enable'] ) { $authid = $this->getRequestVar( $sso['auth_param_name']); @@ -298,37 +298,30 @@ class LoginAction extends Action foreach( $conf['database'] as $dbname=>$dbconf ) { if ( is_array($dbconf) && $dbconf['enabled'] ) - $dbids[$dbname] = array('key' =>$dbname, + $dbids[$dbname] = array('key' =>$dbname, '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_providers',$openid_provider); - $this->setTemplateVar('openid_user_identity',config('security','openid','user_identity')); - //$this->setTemplateVar('openid_provider','identity'); - if ( empty($dbids) ) $this->addNotice('','','no_database_configuration',OR_NOTICE_WARN); if ( !isset($this->templateVars['login_name']) && isset($_COOKIE['or_username']) ) $this->setTemplateVar('login_name',$_COOKIE['or_username']); - - if ( !isset($this->templateVars['login_name']) ) - $this->setTemplateVar('login_name',@$conf['security']['default']['username']); - + + if ( !isset($this->templateVars['login_name']) ) + $this->setTemplateVar('login_name',@$conf['security']['default']['username']); + if ( $this->templateVars['login_name']== @$conf['security']['default']['username']) - $this->setTemplateVar('login_password',@$conf['security']['default']['password']); + $this->setTemplateVar('login_password',@$conf['security']['default']['password']); $this->setTemplateVar( 'dbids',$dbids ); $db = Session::getDatabase(); if ( is_object($db) ) $this->setTemplateVar('actdbid',$db->id); - elseif( isset($this->templateVars['actid']) ) + elseif( isset($this->templateVars['actid']) ) ; else $this->setTemplateVar('actdbid',$conf['database']['default']); @@ -355,11 +348,68 @@ class LoginAction extends Action $this->setTemplateVar('projectid' ,$this->getRequestVar('projectid' ,OR_FILTER_NUMBER) ); $this->setTemplateVar('modelid' ,$this->getRequestVar('modelid' ,OR_FILTER_NUMBER) ); $this->setTemplateVar('languageid',$this->getRequestVar('languageid',OR_FILTER_NUMBER) ); - + $this->setTemplateVar('register' ,$conf['login' ]['register' ]); $this->setTemplateVar('send_password',$conf['login' ]['send_password']); } + + + + /** + * Anzeigen der Loginmaske. + * + * Es wird nur die Loginmaske angezeigt. + * Hier nie "304 not modified" setzen, da sonst keine + * Login-Fehlermeldung erscheinen kann + */ + function openidView() + { + global $conf; + + foreach( $conf['database'] as $dbname=>$dbconf ) + { + if ( is_array($dbconf) && $dbconf['enabled'] ) + $dbids[$dbname] = array('key' =>$dbname, + '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_providers',$openid_provider); + $this->setTemplateVar('openid_user_identity',config('security','openid','user_identity')); + //$this->setTemplateVar('openid_provider','identity'); + + if ( empty($dbids) ) + $this->addNotice('','','no_database_configuration',OR_NOTICE_WARN); + + if ( !isset($this->templateVars['login_name']) && isset($_COOKIE['or_username']) ) + $this->setTemplateVar('login_name',$_COOKIE['or_username']); + + if ( !isset($this->templateVars['login_name']) ) + $this->setTemplateVar('login_name',@$conf['security']['default']['username']); + + if ( $this->templateVars['login_name']== @$conf['security']['default']['username']) + $this->setTemplateVar('login_password',@$conf['security']['default']['password']); + + $this->setTemplateVar( 'dbids',$dbids ); + + $db = Session::getDatabase(); + if ( is_object($db) ) + $this->setTemplateVar('actdbid',$db->id); + elseif( isset($this->templateVars['actid']) ) + ; + else + $this->setTemplateVar('actdbid',$conf['database']['default']); + + $this->setTemplateVar('objectid' ,$this->getRequestVar('objectid' ,OR_FILTER_NUMBER) ); + $this->setTemplateVar('projectid' ,$this->getRequestVar('projectid' ,OR_FILTER_NUMBER) ); + $this->setTemplateVar('modelid' ,$this->getRequestVar('modelid' ,OR_FILTER_NUMBER) ); + $this->setTemplateVar('languageid',$this->getRequestVar('languageid',OR_FILTER_NUMBER) ); + } + /** @@ -563,7 +613,7 @@ class LoginAction extends Action * Es muss noch beim OpenId-Provider die Best�tigung eingeholt werden, danach ist der * Benutzer angemeldet.<br> */ - public function openidView() + public function openidloginView() { global $conf; $openId = Session::get('openid'); @@ -650,7 +700,7 @@ class LoginAction extends Action /** * Login. */ - function loginPost() + function openidPost() { global $conf; @@ -686,8 +736,31 @@ class LoginAction extends Action $this->redirect( $openId->getRedirectUrl() ); return; } - + } + + + + /** + * Login. + */ + function loginPost() + { + global $conf; + $this->checkForDb(); + Session::setUser(''); + + if ( $conf['login']['nologin'] ) + Http::notAuthorized('login disabled'); + + $loginName = $this->getRequestVar('login_name' ,OR_FILTER_ALPHANUM); + $loginPassword = $this->getRequestVar('login_password',OR_FILTER_ALPHANUM); + $newPassword1 = $this->getRequestVar('password1' ,OR_FILTER_ALPHANUM); + $newPassword2 = $this->getRequestVar('password2' ,OR_FILTER_ALPHANUM); + + // Cookie setzen + setcookie('or_username',$loginName,time()+(60*60*24*30*12*2) ); + // Ermitteln, ob der Baum angezeigt werden soll // Ist die Breite zu klein, dann wird der Baum nicht angezeigt //Session::set('showtree',intval($this->getRequestVar('screenwidth')) > $conf['interface']['min_width'] ); diff --git a/language/de.ini.php b/language/de.ini.php @@ -1131,4 +1131,10 @@ MENU_EXTENSION="Erweiterung" MENU_PAGES="Seiten" MENU_TYPE="Typ" MENU_LICENSE="Lizenz" +MENU_STRUCTURE="Struktur" +MENU_SEARCH="Suche" +MENU_ARCHIVE="Archiv" +MENU_OTHER="Andere" +MENU_ACLFORM="Hinzufügen" +MENU_OPENID="Open-Id" MENU_="" \ No newline at end of file diff --git a/themes/default/images/icon/license.png b/themes/default/images/icon/license.png Binary files differ. diff --git a/themes/default/images/icon/openid.png b/themes/default/images/icon/openid.png Binary files differ. diff --git a/themes/default/images/icon/register.png b/themes/default/images/icon/register.png Binary files differ. diff --git a/themes/default/images/icon/structure.png b/themes/default/images/icon/structure.png Binary files differ. diff --git a/themes/default/layout/perspective/login.ini.php b/themes/default/layout/perspective/login.ini.php @@ -2,7 +2,7 @@ [content] -views=login,register,license +views=login,openid,register,license action=login refreshable=false default=login \ No newline at end of file diff --git a/themes/default/templates/login/login.tpl.src.xml b/themes/default/templates/login/login.tpl.src.xml @@ -94,27 +94,6 @@ <newline></newline> <newline></newline> - <!-- Open-Id --> - <if true="config:security/openid/enable"> - <fieldset title="message:OPENID"> - <part class="line"> - <part class="label"> - <text key="openid_user"></text> - <if not="true" empty="config:security/openid/logo_url"> - <image url="config:security/openid/logo_url"></image> - </if> - </part> - <part class="input"> - <radiobox name="openid_provider" list="openid_providers"></radiobox> - <if true="var:openid_user_identity"> - <radio name="openid_provider" value="identity"></radio> - <input name="openid_url" class="name" size="20"></input> - </if> - </part> - </part> - </fieldset> - </if> - <if value="size:dbids" greaterthan="1"> <fieldset title="message:DATABASE" icon="database"> <part class="line"> diff --git a/themes/default/templates/login/openid.tpl.src.xml b/themes/default/templates/login/openid.tpl.src.xml @@ -0,0 +1,55 @@ +<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openrat.de/template ../template.xsd"> + <header views="password"></header> + <form action="login" subaction="login" target="_top"> + + <!-- Open-Id --> + <if true="config:security/openid/enable"> + <fieldset title="message:OPENID"> + <part class="line"> + <part class="label"> + <text key="openid_user"></text> + <if not="true" empty="config:security/openid/logo_url"> + <image url="config:security/openid/logo_url"></image> + </if> + </part> + <part class="input"> + <radiobox name="openid_provider" list="openid_providers"></radiobox> + <if true="var:openid_user_identity"> + <radio name="openid_provider" value="identity"></radio> + <input name="openid_url" class="name" size="20"></input> + </if> + </part> + </part> + </fieldset> + </if> + + <if value="size:dbids" greaterthan="1"> + <fieldset title="message:DATABASE" icon="database"> + <part class="line"> + <part class="label"> + <label for="dbid"> + <text key="DATABASE"></text> + </label> + </part> + <part class="input"> + <selectbox name="dbid" list="dbids" default="var:actdbid"></selectbox> + <hidden name="screenwidth" default="9999"></hidden> + </part> + </part> + </fieldset> + </if> + <else> + <hidden name="dbid" default="var:actdbid"></hidden> + </else> + <hidden name="objectid"></hidden> + <hidden name="modelid"></hidden> + <hidden name="projectid"></hidden> + <hidden name="languageid"></hidden> + </form> + <newline></newline> + <newline></newline> + <link url="config:login/gpl/url" target="_top" class="copyright"> + <text key="GPL"></text> + </link> +</output>+ \ No newline at end of file