Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Controller/Component/ConnectComponent.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ private function __syncFacebookUser(){
}

// check if the user already has an account
// User is logged in but doesn't have a
if($Auth->user('id')){
// User is logged in but doesn't have a
if($Auth->user('id') && $Auth->user('facebook_id') == $this->uid){
$this->hasAccount = true;
$this->User->id = $Auth->user($this->User->primaryKey);
if (!$this->User->field('facebook_id')) {
Expand Down Expand Up @@ -192,7 +192,7 @@ private function __syncFacebookUser(){
*/
public function user($field = null){
if(isset($this->uid)){
if($this->Controller->Session->read('FB.Me') == null){
if($this->Controller->Session->read('FB.Me') == null || $this->Controller->Session->read('FB.Me.id') != $this->uid){
$this->Controller->Session->write('FB.Me', $this->FB->api('/me'));
}
$this->me = $this->Controller->Session->read('FB.Me');
Expand Down
15 changes: 15 additions & 0 deletions Vendor/base_facebook.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ protected function getUserAccessToken() {
// the JS SDK puts a code in with the redirect_uri of ''
if (array_key_exists('code', $signed_request)) {
$code = $signed_request['code'];
if ($code && $code == $this->getPersistentData('code')) {
// short-circuit if the code we have is the same as the one presented
return $this->getPersistentData('access_token');
}

$access_token = $this->getAccessTokenFromCode($code, '');
if ($access_token) {
$this->setPersistentData('code', $code);
Expand Down Expand Up @@ -524,6 +529,10 @@ protected function getUserFromAvailableData() {
if ($signed_request) {
if (array_key_exists('user_id', $signed_request)) {
$user = $signed_request['user_id'];
if($user != $this->getPersistentData('user_id')){
$this->clearAllPersistentData();
}

$this->setPersistentData('user_id', $signed_request['user_id']);
return $user;
}
Expand Down Expand Up @@ -1143,10 +1152,16 @@ protected function getHttpProtocol() {
}
return 'http';
}
/*apache + variants specific way of checking for https*/
if (isset($_SERVER['HTTPS']) &&
($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] == 1)) {
return 'https';
}
/*nginx way of checking for https*/
if (isset($_SERVER['SERVER_PORT']) &&
($_SERVER['SERVER_PORT'] === '443')) {
return 'https';
}
return 'http';
}

Expand Down