Fix body object

This commit is contained in:
Sven Seeberg 2020-10-23 16:59:31 +02:00
parent ac0fc37bfd
commit 6e5500e565
Signed by: sven.seeberg
GPG key ID: 29559DD5A83806B5

View file

@ -8,13 +8,13 @@ function init() {
function get_voting_ids($cfg) {
$body = json_decode(file_get_contents('php://input'));
$event_id = get_event_id($cfg, $body["event_token"]);
$vote_round = $body["round"];
$event_id = get_event_id($cfg, $body->event_token);
$vote_round = $body->round;
$result = [];
if (!$event_id) {
return ["error" => "event not found"];
}
foreach($body["user_names"] as $name) {
foreach($body->user_names as $name) {
$hash = get_hash($cfg, $event_id, $vote_round, $name);
$result[] = ["round" => $vote_round, "user_name" => $name, "hash" => $hash];
}