diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 846d6bc2..8a0f8892 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -10,7 +10,7 @@ on: jobs: Test-Linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 container: image: perl:5.30 diff --git a/IFComp-Dev/docker-compose.yml b/IFComp-Dev/docker-compose.yml index ba8f64e9..df9c5bb8 100644 --- a/IFComp-Dev/docker-compose.yml +++ b/IFComp-Dev/docker-compose.yml @@ -13,13 +13,9 @@ services: - type: bind source: ../IFComp target: /opt/IFComp - volume: - nocopy: true - type: bind source: ./docker-app/docker-script target: /opt/IFComp-Dev/script - volume: - nocopy: true web: build: ./docker-web ports: @@ -32,8 +28,6 @@ services: - type: bind source: ../IFComp target: /opt/IFComp - volume: - nocopy: true db: image: mariadb:10.3 environment: diff --git a/IFComp/lib/IFComp/Controller/Entry.pm b/IFComp/lib/IFComp/Controller/Entry.pm index 5b2e093d..ce9c1300 100644 --- a/IFComp/lib/IFComp/Controller/Entry.pm +++ b/IFComp/lib/IFComp/Controller/Entry.pm @@ -101,6 +101,12 @@ sub create : Chained('root') : PathPart('create') : Args(0) { $c->res->redirect( $c->uri_for_action('/entry/list') ); } + if ( ( !defined( $c->user->paypal ) || $c->user->paypal eq '' ) + && ( !defined( $c->user->venmo ) || $c->user->venmo eq '' ) ) + { + $c->res->redirect( $c->uri_for_action('/entry/list') ); + } + my %new_result_args = ( comp => $c->stash->{current_comp}, author => $c->user->get_object->id, diff --git a/IFComp/lib/IFComp/Form/UserFields.pm b/IFComp/lib/IFComp/Form/UserFields.pm index a3fe2737..a24bb757 100644 --- a/IFComp/lib/IFComp/Form/UserFields.pm +++ b/IFComp/lib/IFComp/Form/UserFields.pm @@ -41,7 +41,14 @@ has_field 'forum_handle' => ( has_field 'paypal' => ( type => 'Text', label => - 'Paypal address, or Venmo handle/phone number (or "decline" if not interested in monetary awards)', + 'Paypal email address, or enter "decline" if not interested in monetary awards', + maxlength => 64, +); + +has_field 'venmo' => ( + type => 'Text', + label => + 'Venmo username/phone number, or enter "decline" if not interested in monetary awards', maxlength => 64, ); @@ -87,8 +94,7 @@ sub validate_url { } -# The paypal field can contain "decline", a paypal email address, or -# a venmo account name / phone number. We allow all of the above. +# The paypal field can contain "decline", a paypal email address sub validate_paypal { my $self = shift; my ($field) = @_; @@ -97,16 +103,33 @@ sub validate_paypal { return unless $payment; if ( ( $payment eq "decline" ) - || ( Email::Valid->address($payment) ) + || ( Email::Valid->address($payment) ) ) + { + $field->value($payment); + } + else { + $field->add_error("This doesn't look like a valid paypal address."); + + } +} + +# a venmo account name / phone number +sub validate_venmo { + my $self = shift; + my ($field) = @_; + + my $payment = $field->value; + return unless $payment; + + if ( ( $payment eq "decline" ) || ( $payment =~ /^[-+()\d ]*$/ ) - || ( $payment =~ /^@\w+/ ) ) + || ( $payment =~ /^@?\w+/ ) ) { $field->value($payment); } else { $field->add_error( - "This doesn't look like a valid paypal address, venmo address, or phone number." - ); + "This doesn't look like a valid venmo name or phone number."); } } diff --git a/IFComp/lib/IFComp/Schema/Result/User.pm b/IFComp/lib/IFComp/Schema/Result/User.pm index 0e20c22e..e105151c 100644 --- a/IFComp/lib/IFComp/Schema/Result/User.pm +++ b/IFComp/lib/IFComp/Schema/Result/User.pm @@ -124,6 +124,12 @@ __PACKAGE__->table("user"); is_nullable: 1 size: 64 +=head2 venmo + + data_type: 'char' + is_nullable: 1 + size: 64 + =head2 rising_star data_type: 'integer' @@ -175,6 +181,8 @@ __PACKAGE__->add_columns( { data_type => "char", is_nullable => 1, size => 32 }, "paypal", { data_type => "char", is_nullable => 1, size => 64 }, + "venmo", + { data_type => "char", is_nullable => 1, size => 64 }, "rising_star", { data_type => "integer", is_nullable => 1 }, ); @@ -300,8 +308,8 @@ __PACKAGE__->has_many( #>>> -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-07-02 23:04:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QWBgb307tu4QG/bg7rfGWA +# Created by DBIx::Class::Schema::Loader v0.07053 @ 2025-06-01 20:06:17 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9WoAg24sR0ghQIGGZebiCw __PACKAGE__->add_column( '+password' => { diff --git a/IFComp/root/src/entry/list.tt b/IFComp/root/src/entry/list.tt index 25cb1fce..43ebd687 100644 --- a/IFComp/root/src/entry/list.tt +++ b/IFComp/root/src/entry/list.tt @@ -78,7 +78,11 @@

Register an entry

[% IF current_comp.status == 'accepting_intents' %] [% IF entries.size < 3 %] -

Add a new entry.

+ [% IF c.user.venmo == '' && c.user.paypal == '' %] +

You cannot add entries until you've speicified either a paypal or venmo account for prizes. Please visit your account profile and update it. + [% ELSE %] +

Add a new entry.

+ [% END %] [% ELSE %]

You can't declare any further entries this year, since you've reached the annual limit of three.

[% END %] diff --git a/IFComp/t/lib/IFCompTestData.pm b/IFComp/t/lib/IFCompTestData.pm index a253e96f..8dce581e 100644 --- a/IFComp/t/lib/IFCompTestData.pm +++ b/IFComp/t/lib/IFCompTestData.pm @@ -31,7 +31,7 @@ sub add_test_data_to_schema { 'password_md5', 'salt_md5', 'email', 'email_is_public', 'url', 'verified', - 'forum_handle', + 'forum_handle', 'venmo', ], [ 1, 'user1', $HASHED_PASSWORD, $SALT, @@ -40,23 +40,23 @@ sub add_test_data_to_schema { 'user1_forum', ], [ 2, 'Alice Author', $HASHED_PASSWORD, - $SALT, 'author@example.com', 1, undef, 1, undef, + $SALT, 'author@example.com', 1, undef, 1, undef, 'aliceworks', ], [ 3, 'Victor Votecounter', $HASHED_PASSWORD, - $SALT, 'votecounter@example.com', 1, undef, 1, undef, + $SALT, 'votecounter@example.com', 1, undef, 1, undef, undef, ], [ 4, 'Connie Curator', $HASHED_PASSWORD, - $SALT, 'curator@example.com', 1, undef, 1, undef, + $SALT, 'curator@example.com', 1, undef, 1, undef, undef, ], [ 5, 'Cheddar Cheez', $HASHED_PASSWORD, - $SALT, 'cheez@example.com', 1, undef, 1, undef, + $SALT, 'cheez@example.com', 1, undef, 1, undef, undef, ], [ 6, 'Patricia Prizemanager', $HASHED_PASSWORD, - $SALT, 'prizes@example.com', 1, undef, 1, undef, + $SALT, 'prizes@example.com', 1, undef, 1, undef, undef, ], ], );