Skip to content

Commit

Permalink
User retrieval fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sztyup committed Jan 6, 2020
1 parent cef57eb commit 4b7ae8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/LAuth/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public function callback(): Account
$account->setCreatedAt(new DateTime());
} else {
$this->updateAccount($account, $providerUser, $tokens);
$account->setUpdatedAt(new DateTime());
}

$account->setUpdatedAt(new DateTime());
$account->setLastSignedIn(new DateTime());

$this->em->flush();
Expand Down
11 changes: 10 additions & 1 deletion src/LAuth/LAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,16 @@ protected function getUserFromAccount(Account $socialAccount): User

// Create user if there are none

$userClass = $this->config->get('user.class');
$userClass = $this->config->get('lauth.user_class');

$existing = $this->em->getRepository($userClass)->findOneBy([
'email' => $socialAccount->getEmail()
]);

if ($existing) {
return $existing;
}

/** @var User $user */
$user = new $userClass();
$user
Expand Down

0 comments on commit 4b7ae8c

Please sign in to comment.