|
|
@@ -351,7 +351,19 @@ class User {
|
|
|
|
|
|
public static function login($login, $pass) {
|
|
|
Lib::loadClass('LDAP');
|
|
|
- $ldap = LDAP::getInstance();
|
|
|
+ $ldap = ('1' == V::get('P5_DONT_USE_LDAP_FOR_AUTH', '', $_SERVER)) ? null : LDAP::getInstance();
|
|
|
+ $authClass = null;
|
|
|
+ {
|
|
|
+ $projectName = Config::getProjectName();
|
|
|
+ $projectPath = Config::getProjectPath();
|
|
|
+ $pathAuthClass = $projectPath ? "{$projectPath}/auth.php" : null;
|
|
|
+ if ($pathAuthClass && file_exists($pathAuthClass)) {
|
|
|
+ require_once $pathAuthClass;
|
|
|
+ $nameAuthClass = "Auth_{$projectName}";
|
|
|
+ if (!class_exists($nameAuthClass)) throw new Exception("Auth class not exists for project '{$projectName}'!");
|
|
|
+ $authClass = $nameAuthClass;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if ($ldap != null && $ldap->isConnected()) {
|
|
|
$user = self::loginByLDAP($login, $pass);
|
|
|
@@ -362,6 +374,13 @@ class User {
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+ } else if ($authClass) {
|
|
|
+ // $classname::aStaticMethod(); // As of PHP 5.3.0
|
|
|
+ $user = $authClass::login($login, $pass);
|
|
|
+ { // default values
|
|
|
+ if (!$user->EMAIL_IMAP_IMPORT_HOST) $user->EMAIL_IMAP_IMPORT_HOST = null;
|
|
|
+ if (!$user->EMAIL_IMAP_IMPORT_USERNAME) $user->EMAIL_IMAP_IMPORT_USERNAME = null;
|
|
|
+ }
|
|
|
} else {
|
|
|
$user = self::loginByDB($login, $pass);
|
|
|
}
|