Skip to content

Commit

Permalink
Merge pull request #4779 from BacLuc/also-activate-user-after-oauth-l…
Browse files Browse the repository at this point in the history
…ogin

api/oauth: also activate user after successful oauth authentication
  • Loading branch information
pmattmann committed Mar 25, 2024
2 parents c9ab08b + 809b447 commit afa6571
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/src/Security/OAuth/GoogleAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public function authenticate(Request $request): Passport {
$profile->surname = $googleUser->getLastName();
$user = new User();
$user->profile = $profile;
}

if (in_array($user->state, [null, User::STATE_NONREGISTERED, User::STATE_REGISTERED])) {
$user->state = User::STATE_ACTIVATED;
}

Expand Down
3 changes: 3 additions & 0 deletions api/src/Security/OAuth/HitobitoAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public function authenticate(Request $request): Passport {
$profile->nickname = $hitobitoUser->getNickName();
$user = new User();
$user->profile = $profile;
}

if (in_array($user->state, [null, User::STATE_NONREGISTERED, User::STATE_REGISTERED])) {
$user->state = User::STATE_ACTIVATED;
}

Expand Down

0 comments on commit afa6571

Please sign in to comment.