Skip to content

Commit

Permalink
Handle null email in oauth login
Browse files Browse the repository at this point in the history
  • Loading branch information
dnna committed Jul 23, 2018
1 parent 6f4d9d1 commit ad23c85
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Sylius/Bundle/CoreBundle/OAuth/UserProvider.php
Expand Up @@ -26,6 +26,7 @@
use Sylius\Component\User\Canonicalizer\CanonicalizerInterface;
use Sylius\Component\User\Model\UserOAuthInterface;
use Sylius\Component\User\Repository\UserRepositoryInterface;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\User\UserInterface;
use Webmozart\Assert\Assert;

Expand Down Expand Up @@ -115,6 +116,8 @@ public function loadUserByOAuthUserResponse(UserResponseInterface $response): Us
if (null !== $user) {
return $this->updateUserByOAuthUserResponse($user, $response);
}
} else {
throw new UsernameNotFoundException('Email is null or not provided');
}

return $this->createUserByOAuthUserResponse($response);
Expand Down

0 comments on commit ad23c85

Please sign in to comment.