Skip to content

Commit

Permalink
Merge pull request #22 from synolia/hotfix/fix-google-user-locale
Browse files Browse the repository at this point in the history
Google user set locale coalesce if null
  • Loading branch information
oallain authored Nov 20, 2024
2 parents acbfbc3 + 3bee759 commit c47c27d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
-
sylius: 1.11.0
symfony: 6.3
-
sylius: 1.12.0
symfony: 5.4
env:
APP_ENV: test
package-name: synolia/sylius-admin-oauth-plugin
Expand Down
4 changes: 2 additions & 2 deletions src/Factory/AdminUserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class AdminUserFactory
{
public static function createByGoogleAccount(GoogleUser $googleUser): customAdminUser
public static function createByGoogleAccount(GoogleUser $googleUser, string $locale): customAdminUser
{
$user = new customAdminUser();
$user->setEmail($googleUser->getEmail());
Expand All @@ -21,7 +21,7 @@ public static function createByGoogleAccount(GoogleUser $googleUser): customAdmi
$user->setHostedDomain($googleUser->getHostedDomain());
$user->setEnabled(true);
$user->setCreatedAt(new \DateTimeImmutable('now'));
$user->setLocaleCode($googleUser->getLocale());
$user->setLocaleCode($locale);
/** @var string|null $googleId */
$googleId = $googleUser->getId();
$user->setGoogleId($googleId);
Expand Down
2 changes: 1 addition & 1 deletion src/Security/Resolver/DomainInformationsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getDomainInformations(AzureResourceOwner|GoogleUser $user): arra
}

/** @var AdminUser $newUser */
$newUser = AdminUserFactory::createByGoogleAccount($user);
$newUser = AdminUserFactory::createByGoogleAccount($user, $this->localeContext->getLocaleCode());

return [
GoogleUser::class => [
Expand Down

0 comments on commit c47c27d

Please sign in to comment.