Final minor pass of a full registration form on the website

This commit is contained in:
Tom Bloor 2017-04-09 14:17:12 +01:00
parent 704f429fa5
commit 1bb483bb5a
4 changed files with 108 additions and 20 deletions

View file

@ -17,6 +17,11 @@ sub register {
return $rs->search({ $key => $value })->count ? undef : 1;
});
$app->validator->add_check( not_in_resultset => sub {
my ( $validation, $name, $value, $key, $rs ) = @_;
return $rs->search({ $key => $value })->count ? 1 : undef;
});
$app->validator->add_check( postcode => sub {
my ( $validation, $name, $value ) = @_;
return Geo::UK::Postcode->new( $value )->valid ? undef : 1;