Profile image stuff

This commit is contained in:
epriestley
2011-01-31 16:00:42 -08:00
parent 03fec6e911
commit e28c2e8899
8 changed files with 56 additions and 6 deletions

View File

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

View File

@@ -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('<br /><h1>Login with Facebook</h1>');
$panel->appendChild('<br /><h1>Login or Register with Facebook</h1>');
$panel->appendChild($facebook_auth);
}