Merge branch 'master' into 'master'

The name can be any value.

There is no reason to limit the caracters that can be used in the name.
Thus, removing the regex.

Fix #97

See merge request !64
This commit is contained in:
Olivier Perez 2015-10-12 22:54:15 +02:00
commit 19f98558f1
6 changed files with 3 additions and 11 deletions

View File

@ -431,6 +431,5 @@ $smarty->assign('editingVoteId', $editingVoteId);
$smarty->assign('message', $message);
$smarty->assign('admin', true);
$smarty->assign('hidden', false);
$smarty->assign('parameter_name_regex', NAME_REGEX);
$smarty->display('studs.tpl');

View File

@ -55,7 +55,7 @@ class InputService {
}
public function filterName($name) {
$filtered = filter_var($name, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => NAME_REGEX]]);
$filtered = trim($name);
return $this->returnIfNotBlank($filtered);
}

View File

@ -23,7 +23,6 @@ const VERSION = '0.9';
// Regex
const POLL_REGEX = '/^[a-z0-9]+$/i';
const CHOICE_REGEX = '/^[012]$/';
const NAME_REGEX = '/^[áàâäãåçéèêëíìîïñóòôöõúùûüýÿæœa-z0-9_ -]+$/i';
const BOOLEAN_REGEX = '/^(on|off|true|false|1|0)$/i';
const BOOLEAN_TRUE_REGEX = '/^(on|true|1)$/i';
const EDITABLE_CHOICE_REGEX = '/^[0-2]$/';

View File

@ -20,10 +20,9 @@ $(document).ready(function () {
$("#poll_form").submit(function (event) {
var name = $("#name").val();
var regexContent = $("#parameter_name_regex").text().split("/");
var regex = new RegExp(regexContent[1], regexContent[2]);
name = name.trim();
if (name.length == 0 || !regex.test(name)) {
if (name.length == 0) {
event.preventDefault();
var newMessage = $("#nameErrorMessage").clone();
$("#message-container").empty();

View File

@ -216,6 +216,5 @@ $smarty->assign('editingVoteId', $editingVoteId);
$smarty->assign('message', $message);
$smarty->assign('admin', false);
$smarty->assign('hidden', $poll->hidden);
$smarty->assign('parameter_name_regex', NAME_REGEX);
$smarty->display('studs.tpl');

View File

@ -48,10 +48,6 @@
</div>
</div>
<div class="hidden">
<p id="parameter_name_regex">{$parameter_name_regex}</p>
</div>
{* Vote table *}