mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
Resolve LDAP registration DAO exception due to empty username
Summary: When logging in as an LDAP user for the first time (thus registering), a DAO exception was being thrown because PhabricatorLDAPRegistrationController wasn't passing in a username to PhabricatorUser::setUsername(). Somewhat separately, since either the PHP LDAP extension's underlying library or Active Directory are returning attributes with lowercased key names, I have to search on sAMAccountName and look for the key samaccountname in the results; this is fine since the config allows these to be defined separately. However I found that PhabricatorLDAPProvider::retrieveUserName() was attempting to use the search attribute rather than the username attribute. This resolves. Test Plan: Tested registration and login against our internal AD infrastructure; worked perfectly. Need help from someone with access to a functional non-AD LDAP implementation; I've added the original author and CCs from D2722 in case they can help test in this regard. Reviewers: epriestley, voldern Reviewed By: voldern CC: voldern, aran, Korvin, auduny, svemir Differential Revision: https://secure.phabricator.com/D3340
This commit is contained in:
parent
5a0b640ccd
commit
b0802a7797
2 changed files with 2 additions and 2 deletions
|
@ -50,7 +50,7 @@ extends PhabricatorAuthController {
|
||||||
$e_realname = true;
|
$e_realname = true;
|
||||||
|
|
||||||
$user = new PhabricatorUser();
|
$user = new PhabricatorUser();
|
||||||
$user->setUsername();
|
$user->setUsername($provider->retrieveUsername());
|
||||||
$user->setRealname($provider->retrieveUserRealName());
|
$user->setRealname($provider->retrieveUserRealName());
|
||||||
|
|
||||||
$new_email = $provider->retrieveUserEmail();
|
$new_email = $provider->retrieveUserEmail();
|
||||||
|
|
|
@ -99,7 +99,7 @@ final class PhabricatorLDAPProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function retrieveUsername() {
|
public function retrieveUsername() {
|
||||||
return $this->userData[$this->getSearchAttribute()][0];
|
return $this->userData[$this->getUsernameAttribute()][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConnection() {
|
public function getConnection() {
|
||||||
|
|
Loading…
Reference in a new issue