diff options
Diffstat (limited to 'inc/auth.php')
-rw-r--r-- | inc/auth.php | 56 |
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, |