Merge pull request #3021 from splitbrain/addomainless

AuthAD: allow empty account suffix
This commit is contained in:
Andreas Gohr 2020-03-26 11:20:47 +01:00 committed by GitHub
commit 95704c8797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -325,8 +325,8 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin
$domain = \dokuwiki\Utf8\PhpString::strtolower(trim($domain));
$user = \dokuwiki\Utf8\PhpString::strtolower(trim($user));
// is this a known, valid domain? if not discard
if (!is_array($this->conf[$domain])) {
// is this a known, valid domain or do we work without account suffix? if not discard
if (!is_array($this->conf[$domain]) && $this->conf['account_suffix'] !== '') {
$domain = '';
}
@ -645,13 +645,17 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin
/**
* Get the user part from a user
*
* When an account suffix is set, we strip the domain part from the user
*
* @param string $user
* @return string
*/
public function getUserName($user)
{
list($name) = explode('@', $user, 2);
return $name;
if ($this->conf['account_suffix'] !== '') {
list($user) = explode('@', $user, 2);
}
return $user;
}
/**