forked from vtsykun/packeton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes vtsykun#233. More fixes GitHub OAuth2 for accounts without emails
- Loading branch information
Showing
7 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
use Packeton\Entity\Group; | ||
use Packeton\Entity\Package; | ||
use Packeton\Entity\User; | ||
use Packeton\Integrations\LoginInterface; | ||
|
||
/** | ||
* @author Jordi Boggiano <[email protected]> | ||
|
@@ -32,8 +33,10 @@ public function findUsersMissingApiToken() | |
public function findByOAuth2Data(array $data): ?User | ||
{ | ||
$user = null; | ||
if (isset($data['user_identifier'])) { | ||
$user = $this->findOneByUsernameOrEmail($data['user_identifier']); | ||
if ($identifier = ($data['user_identifier'] ?? null)) { | ||
$user = ($data['_type'] ?? null) === LoginInterface::LOGIN_USERNAME ? | ||
$this->findOneBy(['usernameCanonical' => mb_strtolower($identifier)]) | ||
: $this->findOneBy(['emailCanonical' => $identifier]); | ||
} | ||
|
||
if (null === $user && isset($data['external_id'])) { | ||
|