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
This commit is contained in:
parent
8d543f7c23
commit
de18f826f0
@ -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');
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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]$/';
|
||||
|
@ -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();
|
||||
|
@ -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');
|
||||
|
@ -48,10 +48,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden">
|
||||
<p id="parameter_name_regex">{$parameter_name_regex}</p>
|
||||
</div>
|
||||
|
||||
|
||||
{* Vote table *}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user