mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 13:00:56 +01:00
Fix Facebook OAuth flow to ask for email.
Summary: Test Plan: Reviewers: CC:
This commit is contained in:
parent
3d796f0b59
commit
af4ab07f46
4 changed files with 11 additions and 0 deletions
|
@ -109,6 +109,7 @@ class PhabricatorLoginController extends PhabricatorAuthController {
|
|||
$redirect_uri = $provider->getRedirectURI();
|
||||
$client_id = $provider->getClientID();
|
||||
$provider_name = $provider->getProviderName();
|
||||
$minimum_scope = $provider->getMinimumScope();
|
||||
|
||||
// TODO: In theory we should use 'state' to prevent CSRF, but the total
|
||||
// effect of the CSRF attack is that an attacker can cause a user to login
|
||||
|
@ -121,6 +122,7 @@ class PhabricatorLoginController extends PhabricatorAuthController {
|
|||
->setAction($auth_uri)
|
||||
->addHiddenInput('client_id', $client_id)
|
||||
->addHiddenInput('redirect_uri', $redirect_uri)
|
||||
->addHiddenInput('scope', $minimum_scope)
|
||||
->setUser($request->getUser())
|
||||
->setMethod('GET')
|
||||
->appendChild(
|
||||
|
|
|
@ -30,6 +30,7 @@ abstract class PhabricatorOAuthProvider {
|
|||
abstract public function getAuthURI();
|
||||
abstract public function getTokenURI();
|
||||
abstract public function getUserInfoURI();
|
||||
abstract public function getMinimumScope();
|
||||
|
||||
public function __construct() {
|
||||
|
||||
|
|
|
@ -54,4 +54,8 @@ class PhabricatorOAuthProviderFacebook extends PhabricatorOAuthProvider {
|
|||
return 'https://graph.facebook.com/me';
|
||||
}
|
||||
|
||||
public function getMinimumScope() {
|
||||
return 'email';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,4 +54,8 @@ class PhabricatorOAuthProviderGithub extends PhabricatorOAuthProvider {
|
|||
return 'https://github.com/api/v2/json/user/show';
|
||||
}
|
||||
|
||||
public function getMinimumScope() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue