Skip to content

Commit

Permalink
Update callback.php (#225)
Browse files Browse the repository at this point in the history
Co-authored-by: gstraccini[bot] <150967461+gstraccini[bot]@users.noreply.github.com>
  • Loading branch information
guibranco and gstraccini[bot] authored Oct 22, 2024
1 parent 290d79f commit b40cf7a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Src/callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@
curl_close($ch);

$user = json_decode($userData, true);

if (isset($user['name']) === true && preg_match('/^(\w+)(?:\s+[\w\s]+)?\s+(\w+)$/', $user['name'], $matches)) {
$user['first_name'] = $matches[1];
$user['last_name'] = $matches[2];
}

$_SESSION['token'] = $token;
$_SESSION['user'] = $user;

header('Location: dashboard.php');
exit();

0 comments on commit b40cf7a

Please sign in to comment.