This commit is contained in:
2026-03-10 22:30:15 -05:00
parent b47e4f1af0
commit 0988ad7a84

View File

@@ -39,10 +39,12 @@ class EveLoginController extends Controller
$user = $this->CreateOrUpdateUser($ssoUser);
// Always regenerate JWT on successful login
$jwtService->forceRefresh($user);
//Login the user
Auth::login($user, true);
// Always regenerate JWT on successful login
$jwtService->forceRefresh($user);
//Regenerate the session
$request->session()->regenerate();
//Send the user to the dashboard
@@ -72,6 +74,7 @@ class EveLoginController extends Controller
private function CreateOrUpdateUser($ssoUser)
{
//Get all the data we need from the ssoUser
$characterId = strtr($ssoUser['sub'], ['CHARACTER:EVE:' => '']);
$characterName = $ssoUser['name'];
$characterOwnerHash = $ssoUser['owner'];
@@ -81,18 +84,20 @@ class EveLoginController extends Controller
$expiresIn = $ssoUser->expiresIn ?? null;
$scopes = is_array($ssoUser['scp']) ? $ssoUser['scp'] : [$ssoUser['scp']];
//Add user to the database
$user = User::updateOrCreate(
['character_id' => $characterId],
[
'avatar' => $avatar,
'character_name' => $characterName,
'character_owner_hash' => $characterOwnerHash,
'token' => $token,
'refresh_token' => $refreshToken,
'expiresIn' => $expiresIn,
]
);
//Update user permissions, privileges, and add to database if not available.
app(\App\Services\UserPrivilegeService::class)->privilegesChanged($user, function($user) {
$user = User::updateOrCreate(
['character_id' => $characterId],
[
'avatar' => $avatar,
'character_name' => $characterName,
'character_owner_hash' => $characterOwnerHash,
'token' => $token,
'refresh_token' => $refreshToken,
'expiresIn' => $expiresIn,
]
);
});
//Delete currently saved scopes, then add the scopes used to login with.
EsiScope::where(['character_id' => $characterId])->delete();
@@ -114,6 +119,7 @@ class EveLoginController extends Controller
]
);
//Send the object back to the calling function
return $user;
}
}