summaryrefslogtreecommitdiff
path: root/inc/auth.php
diff options
context:
space:
mode:
authorJan Schumann <js@schumann-it.com>2012-01-03 02:56:20 +0100
committerJan Schumann <js@schumann-it.com>2012-01-03 02:56:20 +0100
commit9c29eea515b336b23187a86f5b55443571fcba01 (patch)
treed76e1c59ad5d43c78938a5bf917f83432fbaf440 /inc/auth.php
parent3cbcc6538357fd59d70eea92086e8bfcf0443200 (diff)
downloadrpg-9c29eea515b336b23187a86f5b55443571fcba01.tar.gz
rpg-9c29eea515b336b23187a86f5b55443571fcba01.tar.bz2
Setup auth system from plugins
Diffstat (limited to 'inc/auth.php')
-rw-r--r--inc/auth.php56
1 files changed, 34 insertions, 22 deletions
diff --git a/inc/auth.php b/inc/auth.php
index e0f58e5f2..b11a14d50 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -36,29 +36,41 @@ function auth_setup(){
global $AUTH_ACL;
global $lang;
global $config_cascade;
+ global $plugin_controller;
$AUTH_ACL = array();
if(!$conf['useacl']) return false;
- // load the the backend auth functions and instantiate the auth object XXX
- if (@file_exists(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php')) {
- require_once(DOKU_INC.'inc/auth/basic.class.php');
- require_once(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php');
-
- $auth_class = "auth_".$conf['authtype'];
- if (class_exists($auth_class)) {
- $auth = new $auth_class();
- if ($auth->success == false) {
- // degrade to unauthenticated user
- unset($auth);
- auth_logoff();
- msg($lang['authtempfail'], -1);
- }
- } else {
- nice_die($lang['authmodfailed']);
- }
- } else {
- nice_die($lang['authmodfailed']);
+ // try to load auth backend from plugins
+ $plugins = $plugin_controller->getList('auth');
+ foreach ($plugin_controller->getList('auth') as $plugin) {
+ if ($conf['authtype'] === $plugin) {
+ $auth = $plugin_controller->load('auth', $plugin)->getAuth();
+ break;
+ }
+ }
+
+ if (!$auth) {
+ // load the the backend auth functions and instantiate the auth object XXX
+ if (@file_exists(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php')) {
+ require_once(DOKU_INC.'inc/auth/basic.class.php');
+ require_once(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php');
+
+ $auth_class = "auth_".$conf['authtype'];
+ if (class_exists($auth_class)) {
+ $auth = new $auth_class();
+ if ($auth->success == false) {
+ // degrade to unauthenticated user
+ unset($auth);
+ auth_logoff();
+ msg($lang['authtempfail'], -1);
+ }
+ } else {
+ nice_die($lang['authmodfailed']);
+ }
+ } else {
+ nice_die($lang['authmodfailed']);
+ }
}
if(!$auth) return;
@@ -675,7 +687,7 @@ function auth_sendPassword($user,$password){
if(empty($conf['mailprefix'])) {
$subject = $lang['regpwmail'];
- } else {
+ } else {
$subject = '['.$conf['mailprefix'].'] '.$lang['regpwmail'];
}
@@ -920,10 +932,10 @@ function act_resendpwd(){
if(empty($conf['mailprefix'])) {
$subject = $lang['regpwmail'];
- } else {
+ } else {
$subject = '['.$conf['mailprefix'].'] '.$lang['regpwmail'];
}
-
+
if(mail_send($userinfo['name'].' <'.$userinfo['mail'].'>',
$subject,
$text,