Fixes #124 - vote deletion

This commit is contained in:
Olivier PEREZ 2015-12-08 00:12:20 +01:00
parent 0c5f623ce0
commit cb0e74fba8
2 changed files with 3 additions and 2 deletions

View file

@ -245,9 +245,9 @@ if (!empty($_POST['save'])) { // Save edition of an old vote
// -------------------------------
if (!empty($_GET['delete_vote'])) {
$vote_id = filter_input(INPUT_GET, 'delete_vote', FILTER_VALIDATE_INT);
$vote_id = filter_input(INPUT_GET, 'delete_vote', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => BASE64_REGEX]]);
$vote_id = Utils::base64url_decode($vote_id);
if ($adminPollService->deleteVote($poll_id, $vote_id)) {
if ($vote_id && $adminPollService->deleteVote($poll_id, $vote_id)) {
$message = new Message('success', __('adminstuds', 'Vote deleted'));
} else {
$message = new Message('danger', __('Error', 'Failed to delete the vote'));