|
@@ -36,6 +36,11 @@ class FacebookProvider implements UserProviderInterface
|
36
|
36
|
return $this->userManager->findUserBy(array('facebook_id' => $fbId));
|
37
|
37
|
}
|
38
|
38
|
|
|
39
|
+ public function findUserByEmail($email)
|
|
40
|
+ {
|
|
41
|
+ return $this->userManager->findUserBy(array('email' => $this->userManager->canonicalizeEmailLocal($email)));
|
|
42
|
+ }
|
|
43
|
+
|
39
|
44
|
public function loadUserByUsername($username)
|
40
|
45
|
{
|
41
|
46
|
$user = $this->findUserByFbId($username);
|
|
@@ -46,7 +51,9 @@ class FacebookProvider implements UserProviderInterface
|
46
|
51
|
throw new UsernameNotFoundException('The user is not authenticated on facebook');
|
47
|
52
|
$fbdata = null;
|
48
|
53
|
}
|
49
|
|
-
|
|
54
|
+
|
|
55
|
+ $user = $this->findUserByEmail($fbdata['email']);
|
|
56
|
+
|
50
|
57
|
if (!empty($fbdata)) {
|
51
|
58
|
if (empty($user)) {
|
52
|
59
|
$user = $this->userManager->getNewReadyUser();
|
|
@@ -71,7 +78,7 @@ class FacebookProvider implements UserProviderInterface
|
71
|
78
|
if (!$this->supportsClass(get_class($user)) || !$user->getFacebookId()) {
|
72
|
79
|
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
|
73
|
80
|
}
|
74
|
|
-
|
|
81
|
+
|
75
|
82
|
return $this->loadUserByUsername($user->getFacebookId());
|
76
|
83
|
}
|
77
|
84
|
}
|