Skip to content

Commit

Permalink
Fixed Issue in Facebook login if website doesn't have access to retri…
Browse files Browse the repository at this point in the history
…eve email of user from Facebook
  • Loading branch information
eSilverStrike committed Jun 26, 2022
1 parent aa04406 commit 7e4495d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion system/classes/oauthhelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ protected function _getUpdateUserInfo($info)
if ( isset($info->location->name) ) {
$userinfo['location'] = $info->location->name;
}
if ( isset($info->email ) ) {
$userinfo['email'] = $info->email;
}
break;

case 'Google' :
Expand Down Expand Up @@ -398,9 +401,14 @@ protected function _getCreateUserInfo($info)
{
switch ($this->client->server) {
case 'Facebook' :
// Facebook app for website may not have access to email
$mail = '';
if ( isset($info->email)) {
$mail = $info->email;
}
$users = array(
'loginname' => (isset($info->first_name) ? $info->first_name : $info->id),
'email' => $info->email,
'email' => $mail,
'passwd' => '',
'passwd2' => '',
'fullname' => $info->name,
Expand Down Expand Up @@ -440,6 +448,7 @@ protected function _getCreateUserInfo($info)
break;

case 'Twitter' :
// Twitter app for website may not have access to email
$mail = '';
if ( isset($info->email)) {
$mail = $info->email;
Expand Down

0 comments on commit 7e4495d

Please sign in to comment.