mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +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:
parent
c0d48d0b2d
commit
2b946459b5
1 changed files with 18 additions and 0 deletions
|
@ -192,6 +192,24 @@ final class PhabricatorOAuthLoginController
|
|||
'accounts, log in to your Phabricator account and then go to '.
|
||||
'Settings.</p>',
|
||||
$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/');
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
|
|
Loading…
Reference in a new issue