diff --git a/conf/default.conf.php b/conf/default.conf.php
index a5bb05d2fa..cf02b03b6a 100644
--- a/conf/default.conf.php
+++ b/conf/default.conf.php
@@ -42,5 +42,7 @@ return array(
'recaptcha.private-key' => null,
+ 'user.default-profile-image-phid' => 'PHID-FILE-f57aaefce707fc4060ef',
+
);
diff --git a/src/applications/auth/controller/facebookauth/PhabricatorFacebookAuthController.php b/src/applications/auth/controller/facebookauth/PhabricatorFacebookAuthController.php
index 7f86928722..818e291d21 100644
--- a/src/applications/auth/controller/facebookauth/PhabricatorFacebookAuthController.php
+++ b/src/applications/auth/controller/facebookauth/PhabricatorFacebookAuthController.php
@@ -131,6 +131,24 @@ class PhabricatorFacebookAuthController extends PhabricatorAuthController {
return id(new AphrontRedirectResponse())
->setURI('/');
}
+
+ $known_email = id(new PhabricatorUser())
+ ->loadOneWhere('email = %s', $user_data['email']);
+ if ($known_email) {
+ if ($known_email->getFacebookUID()) {
+ throw new Exception(
+ "The email associated with the Facebook account you just logged in ".
+ "with is already associated with another Phabricator account which ".
+ "is, in turn, associated with a Facebook account different from ".
+ "the one you just logged in with.");
+ }
+ $known_email->setFacebookUID($user_id);
+ $session_key = $known_email->establishSession('web');
+ $request->setCookie('phusr', $known_email->getUsername());
+ $request->setCookie('phsid', $session_key);
+ return id(new AphrontRedirectResponse())
+ ->setURI('/');
+ }
$current_user = $this->getRequest()->getUser();
if ($current_user->getPHID()) {
diff --git a/src/applications/auth/controller/login/PhabricatorLoginController.php b/src/applications/auth/controller/login/PhabricatorLoginController.php
index dc871ccb44..774a26d7e9 100644
--- a/src/applications/auth/controller/login/PhabricatorLoginController.php
+++ b/src/applications/auth/controller/login/PhabricatorLoginController.php
@@ -85,6 +85,7 @@ class PhabricatorLoginController extends PhabricatorAuthController {
$panel = new AphrontPanelView();
$panel->setHeader('Phabricator Login');
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
+// $panel->setCreateButton('Register New Account', '/login/register/');
$panel->appendChild($form);
$fbauth_enabled = PhabricatorEnv::getEnvConfig('facebook.auth-enabled');
@@ -117,7 +118,7 @@ class PhabricatorLoginController extends PhabricatorAuthController {
id(new AphrontFormSubmitControl())
->setValue("Login with Facebook \xC2\xBB"));
- $panel->appendChild('
{$author} {$verb} this revision.
". + "{$author_link} {$verb} this revision.
". '