1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Inform user about associated accounts in failed login

Summary:
Sometimes people create their account in Phabricator using some OAuth provider, forget about it and then tries to login with another provider.

Provide this information to them.

Test Plan: Tried to link an account linked to already existing user.

Reviewers: epriestley

Reviewed By: epriestley

CC: robarnold, aran, Korvin

Differential Revision: https://secure.phabricator.com/D2857
This commit is contained in:
vrana 2012-06-25 17:45:22 -07:00
parent c0d48d0b2d
commit 2b946459b5

View file

@ -192,6 +192,24 @@ final class PhabricatorOAuthLoginController
'accounts, log in to your Phabricator account and then go to '. 'accounts, log in to your Phabricator account and then go to '.
'Settings.</p>', 'Settings.</p>',
$provider_name)); $provider_name));
$user = id(new PhabricatorUser())
->loadOneWhere('phid = %s', $known_email->getUserPHID());
$oauth_infos = id(new PhabricatorUserOAuthInfo())
->loadAllWhere('userID = %d', $user->getID());
if ($oauth_infos) {
$providers = array();
foreach ($oauth_infos as $info) {
$provider = $info->getOAuthProvider();
$providers[] = PhabricatorOAuthProvider::newProvider($provider)
->getProviderName();
}
$dialog->appendChild(
hsprintf(
'<p>The account is associated with: %s.</p>',
implode(', ', $providers)));
}
$dialog->addCancelButton('/login/'); $dialog->addCancelButton('/login/');
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);