Skip to content

Commit

Permalink
Merge pull request #125 from gregorybesson/develop
Browse files Browse the repository at this point in the history
fb auth
  • Loading branch information
gregorybesson authored Sep 28, 2018
2 parents d9bd67e + 2d07b24 commit 4e9141b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Authentication/Adapter/HybridAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function authenticate(\Zend\EventManager\EventInterface $authEvent)
$userProfile = null;
try {
$adapter = $this->getHybridAuth()->authenticate($provider);
if ($adapter->isUserConnected()) {
if ($adapter->isConnected()) {
$userProfile = $adapter->getUserProfile();
}
} catch (\Exception $ex) {
Expand All @@ -96,7 +96,7 @@ public function authenticate(\Zend\EventManager\EventInterface $authEvent)
$this->getHybridAuth()->getAdapter($provider)->logout();
// Essayer de se connecter à nouveau
$adapter = $this->getHybridAuth()->authenticate($provider);
if ($adapter->isUserConnected()) {
if ($adapter->isConnected()) {
$userProfile = $adapter->getUserProfile();
}
} else {
Expand Down
7 changes: 4 additions & 3 deletions src/Controller/Frontend/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public function loginAction()
*/
public function registerAction()
{

if ($this->zfcUserAuthentication()->hasIdentity()) {

return $this->redirect()->toUrl($this->url()->fromRoute($this->getOptions()->getLoginRedirectRoute()));
}
$request = $this->getRequest();
Expand Down Expand Up @@ -123,9 +125,8 @@ public function registerAction()
if (! $redirect && $this->getOptions()->getLoginRedirectRoute() != '') {
$redirect = $this->url()->fromRoute($this->getOptions()->getLoginRedirectRoute());
}
$redir = $this->url()
->fromRoute('frontend/zfcuser/login') .'/' . $socialnetwork . ($redirect ? '?redirect=' . $redirect : '');

//$redir = $this->url()->fromRoute('frontend/zfcuser/login') .'/' . $socialnetwork . ($redirect ? '?redirect=' . $redirect : '');
$redir = $this->url()->fromRoute('frontend/zfcuser/authenticate') .'?provider=' . $socialnetwork . ($redirect ? '&redirect=' . $redirect : '');
return $this->redirect()->toUrl($redir);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public function getServiceConfig()
$config = $sm->get('SocialConfig');

try {
$auth = new \Hybrid_Auth($config);
$auth = new \Hybridauth\Hybridauth($config);
} catch (\Exception $e) {
throw new \Exception($e->getMessage(), $e->getCode());
}
Expand Down
12 changes: 6 additions & 6 deletions src/Service/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function getInfoMe($socialnetworktype, $options = array())
if (is_string($socialnetworktype)) {
try {
$adapter = $this->getHybridAuth()->authenticate($provider);
if ($adapter->isUserConnected()) {
if ($adapter->isConnected()) {
$infoMe = $adapter->getUserProfile();
}
} catch (\Exception $ex) {
Expand All @@ -150,13 +150,13 @@ public function getInfoMe($socialnetworktype, $options = array())
$this->getHybridAuth()->getAdapter($provider)->logout();
// Essayer de se connecter à nouveau
$adapter = $this->getHybridAuth()->authenticate($provider);
if ($adapter->isUserConnected()) {
if ($adapter->isConnected()) {
$infoMe = $adapter->getUserProfile();
}
} else {
$authEvent->setCode(\Zend\Authentication\Result::FAILURE)
->setMessages(array('Invalid provider'));
$this->setSatisfied(false);
// $authEvent->setCode(\Zend\Authentication\Result::FAILURE)
// ->setMessages(array('Invalid provider'));
// $this->setSatisfied(false);

return null;
}
Expand Down Expand Up @@ -206,7 +206,7 @@ public function feedFacebook($message)
{
try {
$adapter = $this->getHybridAuth()->authenticate('Facebook');
if ($adapter->isUserConnected()) {
if ($adapter->isConnected()) {
$adapter->setUserStatus($message);
}
} catch (\Exception $e) {
Expand Down

0 comments on commit 4e9141b

Please sign in to comment.