diff options
author | Yorhel <git@yorhel.nl> | 2020-02-16 11:16:55 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-02-21 13:47:52 +0100 |
commit | 50657dc2a4cbe4fa5efede82053a96b327ed0338 (patch) | |
tree | 285c67eb8dfe88ef0e42f337236cd76c4ae16b01 /lib/VNWeb/Validation.pm | |
parent | 624ad4124cc3e49acd3903b9c9062a03f3616ad8 (diff) |
v2rw/WIP: Incremental rewrite of the release edit form
The new form does change a few things to the UI, so I'll keep the old
form around for a while so that people have something to fallback to
when it doesn't work (like, right now).
I'm also doing this rewrite in multiple commits as it's a pretty large
change.
Diffstat (limited to 'lib/VNWeb/Validation.pm')
-rw-r--r-- | lib/VNWeb/Validation.pm | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/VNWeb/Validation.pm b/lib/VNWeb/Validation.pm index d77fc54a..d7b16bf6 100644 --- a/lib/VNWeb/Validation.pm +++ b/lib/VNWeb/Validation.pm @@ -7,6 +7,7 @@ use VNDB::Types; use VNDB::Config; use VNWeb::Auth; use VNWeb::DB; +use VNDB::Func 'gtintype'; use Carp 'croak'; use Exporter 'import'; @@ -28,6 +29,7 @@ TUWF::set custom_validations => { username => { regex => qr/^(?!-*[a-z][0-9]+-*$)[a-z0-9-]*$/, minlength => 2, maxlength => 15 }, password => { length => [ 4, 500 ] }, language => { enum => \%LANGUAGE }, + gtin => { uint => 1, func => sub { $_[0] eq 0 || gtintype($_[0]) } }, # Accepts a user-entered vote string (or '-' or empty) and converts that into a DB vote number (or undef) - opposite of fmtvote() vnvote => { required => 0, default => undef, regex => qr/^(?:|-|[1-9]|10|[1-9]\.[0-9]|10\.0)$/, func => sub { $_[0] = $_[0] eq '-' ? undef : 10*$_[0]; 1 } }, # Sort an array by the listed hash keys, using string comparison on each key |