mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-08 19:25:10 -05:00
Finished consent endpoint.
Also modified some log levels to make more sense.
This commit is contained in:
@@ -20,12 +20,12 @@ public function login(SteamLoginRequest $request)
|
||||
$steamResponse = $steamRequest->authenticateTicket();
|
||||
|
||||
if($steamResponse === false) {
|
||||
$log->info('Authenticating session ticket failed: {error}.', ['error' => $steamRequest->getError()]);
|
||||
$log->alert('Authenticating session ticket failed: {error}.', ['error' => $steamRequest->getError()]);
|
||||
return response('Error: '.$steamRequest->getError(), 500);
|
||||
}
|
||||
|
||||
if($steamResponse->isBanned()) {
|
||||
$log->info('User with SteamID "{id}" denied login. User is Banned via Steam', ['id' => $steamResponse->steamId]);
|
||||
$log->notice('User with SteamID "{id}" denied login. User is Banned via Steam', ['id' => $steamResponse->steamId]);
|
||||
return response('Unauthorized: You are Steam banned', 401);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,21 +3,25 @@
|
||||
namespace App\Http\Controllers\Api\Eula;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Responses\Api\Eula\EulaConsentResponse;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class EulaConsentController extends Controller
|
||||
{
|
||||
public function get()
|
||||
public function get(\Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
if($user->eula_consent)
|
||||
return true;
|
||||
return false;
|
||||
$response = new EulaConsentResponse($user->eula_consent, $user->id);
|
||||
|
||||
return json_encode($response);
|
||||
}
|
||||
|
||||
public function put()
|
||||
{
|
||||
$user = Auth::user();
|
||||
dd($user);
|
||||
$user->eula_consent = true;
|
||||
$user->save();
|
||||
|
||||
return json_encode(new EulaConsentResponse(true, $user->id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Eula;
|
||||
|
||||
class EulaConsentResponse
|
||||
{
|
||||
|
||||
}
|
||||
2
dist/app/Http/Middleware/AccessLogger.php
vendored
2
dist/app/Http/Middleware/AccessLogger.php
vendored
@@ -23,7 +23,7 @@ public function handle(Request $request, Closure $next): Response
|
||||
$log->queryParams = $request->getQueryString();
|
||||
$log->body = $request->all();
|
||||
|
||||
Log::channel('db_requests')->info(json_encode($log));
|
||||
Log::channel('db_requests')->info($log->url."\n".json_encode($log));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
34
dist/app/Http/Responses/Api/Eula/EulaConsentResponse.php
vendored
Normal file
34
dist/app/Http/Responses/Api/Eula/EulaConsentResponse.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Responses\Api\Eula;
|
||||
|
||||
class EulaConsentResponse
|
||||
{
|
||||
public bool $IsGiven;
|
||||
|
||||
public string $ConsentId = 'eula2';
|
||||
|
||||
public int $UpdateDate = 1689714606;
|
||||
|
||||
public bool $AttentionNeeded = false;
|
||||
|
||||
public ConsentVersion $LatestVersion;
|
||||
|
||||
public string $UserId;
|
||||
|
||||
public function __construct(bool $isGiven = false, string $userId)
|
||||
{
|
||||
$this->IsGiven = $isGiven;
|
||||
$this->UserId = $userId;
|
||||
$this->LatestVersion = new ConsentVersion();
|
||||
}
|
||||
}
|
||||
|
||||
class ConsentVersion {
|
||||
public function __construct(
|
||||
public string $Label = "eula2",
|
||||
public int $EntryDate = 1689714606
|
||||
)
|
||||
{
|
||||
}
|
||||
}
|
||||
2
dist/config/app.php
vendored
2
dist/config/app.php
vendored
@@ -70,7 +70,7 @@
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
'timezone' => 'Europe/Berlin',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user