summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util/ValidateTemplates.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-09-26 13:51:11 +0200
committerYorhel <git@yorhel.nl>2019-09-26 13:51:14 +0200
commit092158fee02c3516ae08f7efcef8f1774bf823e5 (patch)
tree047b1ebe9c534291c2e246d9378dcdce75148c55 /lib/VNDB/Util/ValidateTemplates.pm
parentd735e66d7d9b2d8c9a965ec96753864ff8c306c2 (diff)
Disallow usernames that look like DB identifiers + minor BBCode fix
A '-' before or after a DB identifier now counts as a "word character", meaning in "d5-something" won't turn that "d5" into a link.
Diffstat (limited to 'lib/VNDB/Util/ValidateTemplates.pm')
-rw-r--r--lib/VNDB/Util/ValidateTemplates.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/VNDB/Util/ValidateTemplates.pm b/lib/VNDB/Util/ValidateTemplates.pm
index 540ff709..7966b319 100644
--- a/lib/VNDB/Util/ValidateTemplates.pm
+++ b/lib/VNDB/Util/ValidateTemplates.pm
@@ -14,7 +14,7 @@ TUWF::set(
validate_templates => {
id => { template => 'uint', max => 1<<40 },
page => { template => 'uint', max => 1000 },
- uname => { regex => qr/^[a-z0-9-]*$/, minlength => 2, maxlength => 15 },
+ uname => { regex => qr/^[a-z0-9-]*$/, func => sub { $_[0] !~ /^-*[a-z][0-9]+-*$/ }, minlength => 2, maxlength => 15 },
gtin => { func => \&gtintype },
editsum => { maxlength => 5000, minlength => 2 },
json => { func => \&json_validate, inherit => ['json_fields','json_maxitems','json_unique','json_sort'], default => [] },