mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
check hash before checking if user already has access
This commit is contained in:
parent
88052f1b06
commit
a02e89e36b
1 changed files with 5 additions and 5 deletions
|
|
@ -834,6 +834,11 @@ Response::ResponseCode AbstractServerSocketInterface::cmdReplaySubmitCode(const
|
|||
|
||||
const auto &replayName = replayExistsQuery->value(0).toString();
|
||||
|
||||
// Check if hash is correct
|
||||
if (hash != createHashForReplay(gameId.toInt())) {
|
||||
return Response::RespNameNotFound;
|
||||
}
|
||||
|
||||
// Determine if user already has access to replay
|
||||
auto *alreadyAccessQuery = sqlInterface->prepareQuery(
|
||||
"select 1 from {prefix}_replays_access where id_game = :id_game and id_player = :id_player");
|
||||
|
|
@ -846,11 +851,6 @@ Response::ResponseCode AbstractServerSocketInterface::cmdReplaySubmitCode(const
|
|||
return Response::RespOk;
|
||||
}
|
||||
|
||||
// Check if hash is correct
|
||||
if (hash != createHashForReplay(gameId.toInt())) {
|
||||
return Response::RespNameNotFound;
|
||||
}
|
||||
|
||||
// Grant the User access to the replay
|
||||
auto *grantReplayAccessQuery =
|
||||
sqlInterface->prepareQuery("insert into {prefix}_replays_access (id_game, id_player, replay_name, do_not_hide) "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue