mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-11 12:45:22 -05:00
Fixed some bugs with the validation of the end of match requests.
Forgot to change the false of the Authorize() method. Fixed comparison of Match creator and user that send teh request. To compare objects don't use ===, use == instead.
This commit is contained in:
@@ -114,8 +114,8 @@ public function endOfMatch(EndOfMatchRequest $request)
|
||||
$game = Game::find($request->matchId);
|
||||
$user = Auth::user();
|
||||
|
||||
if($game->creator !== $user)
|
||||
throw new AuthorizationException('you are not the creator of the match.');
|
||||
if($game->creator != $user)
|
||||
return response('you are not the creator of the match.', 403);
|
||||
|
||||
$game->status = MatchStatus::Killed;
|
||||
$game->save();
|
||||
@@ -131,7 +131,7 @@ public function playerEndOfMatch(PlayerEndOfMatchRequest $request)
|
||||
if($game === null)
|
||||
return response('Match not found.', 404);
|
||||
|
||||
if ($game->creator !== $user)
|
||||
if ($game->creator != $user)
|
||||
throw new AuthorizationException('User is not host of given match');
|
||||
|
||||
$user = User::find($request->playerId);
|
||||
|
||||
Reference in New Issue
Block a user