Skip to content

Commit

Permalink
Merge pull request #137 from gregorybesson/develop
Browse files Browse the repository at this point in the history
fix fb registration
  • Loading branch information
gregorybesson authored Apr 12, 2019
2 parents e1d7d5f + 8c893c9 commit e3b1104
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
4 changes: 2 additions & 2 deletions config/social.config.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ return array (
'enabled' => true,
'keys' =>
array (
'id' => '118474821657382',
'key' => '118474821657382',
'secret' => 'fde26982baea07cab11881876a45a5fe',
),
'scope' => 'email,publish_stream,user_birthday,user_location,read_friendlists,user_relationships,user_relationship_details,read_mailbox,user_status,friends_about_me,friends_photos,read_friendlists,offline_access',
Expand All @@ -24,7 +24,7 @@ return array (
),
'fields' =>
array (
0 => 'id',
0 => 'key',
1 => 'secret',
),
),
Expand Down
18 changes: 5 additions & 13 deletions src/Authentication/Adapter/HybridAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,8 @@ public function authenticate(\Zend\EventManager\EventInterface $authEvent)
} else {
$localUser = $this->instantiateLocalUser();
$localUser->setDisplayName($userProfile->displayName)
->setPassword($provider);
if ($userProfile->emailVerified) {
$localUser->setEmail($userProfile->emailVerified);
}
->setPassword($provider)
->setEmail($userProfile->email);
$this->insert($localUser, 'other', $userProfile);
}

Expand All @@ -156,7 +154,7 @@ public function authenticate(\Zend\EventManager\EventInterface $authEvent)
$user = $mapper->findById($localUserProvider->getUser()->getId());
if (!in_array($user->getState(), $zfcUserOptions->getAllowedLoginStates())) {
$authEvent->setCode(Result::FAILURE_UNCATEGORIZED)
->setMessages(array('A record with the supplied identity is not active.'));
->setMessages(array('A record with the supplied identity is not active.'));
$this->setSatisfied(false);

return false;
Expand Down Expand Up @@ -344,14 +342,8 @@ protected function instantiateLocalUser()

protected function facebookToLocalUser($userProfile)
{
if (!isset($userProfile->emailVerified)) {
throw new \RuntimeException(
'Please verify your email with Facebook before attempting login',
Result::FAILURE_CREDENTIAL_INVALID
);
}
$mapper = $this->getZfcUserMapper();
if (false != ($localUser = $mapper->findByEmail($userProfile->emailVerified))) {
if (false != ($localUser = $mapper->findByEmail($userProfile->email))) {
return $localUser;
}
$localUser = $this->instantiateLocalUser();
Expand All @@ -367,7 +359,7 @@ protected function facebookToLocalUser($userProfile)
);
}

$localUser->setEmail($userProfile->emailVerified)
$localUser->setEmail($userProfile->email)
->setDisplayName($userProfile->displayName)
->setFirstname($userProfile->firstName)
->setLastname($userProfile->lastName)
Expand Down

0 comments on commit e3b1104

Please sign in to comment.