mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Fix GitHub OAuth Registration for users without a name
Summary: Github allows you to have an account without a real name. The OAuth controller actually handles this fine, mostly, except that it calls a bogus method. Also there is some null vs empty string confusion. Test Plan: Deleted my name on Github and then registered for an account on Phabricator. Reviewed By: tuomaspelkonen Reviewers: jungejason, tuomaspelkonen, aran CC: anjali, aran, tuomaspelkonen Differential Revision: 247
This commit is contained in:
parent
4e70c434fd
commit
870f4bfe73
3 changed files with 6 additions and 4 deletions
|
@ -60,9 +60,9 @@ class PhabricatorOAuthDefaultRegistrationController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->getRealName() === null) {
|
if (!strlen($user->getRealName())) {
|
||||||
$user->setRealName($request->getStr('realname'));
|
$user->setRealName($request->getStr('realname'));
|
||||||
if (!strlen($user->getStr('realname'))) {
|
if (!strlen($user->getRealName())) {
|
||||||
$e_realname = 'Required';
|
$e_realname = 'Required';
|
||||||
$errors[] = 'Real name is required.';
|
$errors[] = 'Real name is required.';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -78,7 +78,7 @@ class PhabricatorOAuthProviderGithub extends PhabricatorOAuthProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function retrieveUserEmail() {
|
public function retrieveUserEmail() {
|
||||||
return $this->userData['email'];
|
return idx($this->userData, 'email');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function retrieveUserAccountName() {
|
public function retrieveUserAccountName() {
|
||||||
|
@ -103,7 +103,7 @@ class PhabricatorOAuthProviderGithub extends PhabricatorOAuthProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function retrieveUserRealName() {
|
public function retrieveUserRealName() {
|
||||||
return $this->userData['name'];
|
return idx($this->userData, 'name');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,7 @@
|
||||||
phutil_require_module('phabricator', 'applications/auth/oauth/provider/base');
|
phutil_require_module('phabricator', 'applications/auth/oauth/provider/base');
|
||||||
phutil_require_module('phabricator', 'infrastructure/env');
|
phutil_require_module('phabricator', 'infrastructure/env');
|
||||||
|
|
||||||
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
||||||
|
|
||||||
phutil_require_source('PhabricatorOAuthProviderGithub.php');
|
phutil_require_source('PhabricatorOAuthProviderGithub.php');
|
||||||
|
|
Loading…
Reference in a new issue