1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10: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:
epriestley 2011-05-06 17:01:00 -07:00
parent 4e70c434fd
commit 870f4bfe73
3 changed files with 6 additions and 4 deletions

View file

@ -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 {

View file

@ -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');
} }
} }

View file

@ -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');